Re: Running a Sub from a cell expression in Excel
- From: "David K." <kerenshor@xxxxxxx>
- Date: Sun, 16 Dec 2007 03:29:15 -0800 (PST)
On 15 דצמבר, 22:59, Steve Rindsberg <ab...@xxxxxxxxxxxxx> wrote:
In article <84f316e3-fd70-4398-9277-ca5041ac0...@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
================================================
Steve,
Thank you for your help.
Yes, I know that a function returns a value. Yet, Sub is what I need,
since it performs some procedure. for example: Say my Sub displays
some message.
My question still stands; How do I run a Sub from within an Excel
cell.
David
.
- Follow-Ups:
- Re: Running a Sub from a cell expression in Excel
- From: Steve Rindsberg
- Re: Running a Sub from a cell expression in Excel
- References:
- Running a Sub from a cell expression in Excel
- From: David K.
- Re: Running a Sub from a cell expression in Excel
- From: Steve Rindsberg
- Running a Sub from a cell expression in Excel
- Prev by Date: Re: Running a Sub from a cell expression in Excel
- Next by Date: Mailmerge and VBA
- Previous by thread: Re: Running a Sub from a cell expression in Excel
- Next by thread: Re: Running a Sub from a cell expression in Excel
- Index(es):
Relevant Pages
|
Loading