Re: Running a Sub from a cell expression in Excel



In article <84f316e3-fd70-4398-9277-ca5041ac0a81@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
David K. wrote:
I am new to VBA. I wrote a simple Sub in VBA (say MySub). When I try
to run it from a cell expression in Excel (=MySub), I get the
following message: "That name is not valid".
Any help will be appreciated.

I think you need a function rather than a sub (sub doesn't return a value, a
function does)

Example: this in a cell:

=GimmeFive()

Invokes this:

Function GimmeFive() As Integer
GimmeFive = 5
End Function

I'm a PowerPointPusher. There's probably lots more to this I haven't a clue
about, but this might be enough to get you going.

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================


.



Relevant Pages

  • Re: Running a Sub from a cell expression in Excel
    ... to run it from a cell expression in Excel, ... I think you need a function rather than a sub (sub doesn't return a value, ... Steve Rindsberg, PPT MVP ... How do I run a Sub from within an Excel ...
    (microsoft.public.office.developer.vba)
  • Re: Running a Sub from a cell expression in Excel
    ... I think you need a function rather than a sub (sub doesn't return a value, ... Example:  this in a cell: ... Steve Rindsberg, PPT MVP ... How do I run a Sub from within an Excel ...
    (microsoft.public.office.developer.vba)
  • Re: How to convert RGB color to scheme color?
    ... I mostly work in MSGraph where this is even loopier, but in Excel you need to ... Tools, Options, Color tab, click the palette chip you want to work ... Steve Rindsberg, PPT MVP ... Sub WatchThis() ...
    (microsoft.public.office.developer.automation)

Loading