Running macros or functions?

  • Thread starter Thread starter newbie
  • Start date Start date
N

newbie

First of all i want to thank people who come here and help others.
I have posted a few questions and have many nice people help me.

Now for my question: I am confused. I just started a few days ago
learning to do some VBA. I noticed that when i create a macro in VBA i
see VBA makes the following code entries in the code window:

sub name1()
end sub

The name1 is the macro name that i assign when invoking the create
macro button in the macro dialog box. But when i change the code to,
Function name() the macro name that i created disappears? Now i want a
return value to go into a cell for use later on so i feel i need a
function and not a subroutine. The only other way might be to use a
subroutine but write a value back to a cell of my choosing, any
thoughts on this as far as best practice for my situation? You can
tell i am really new at this, sorry for any dumb questions.

Andrew
 
Functions are the way to go for returning a value to a cell, they just don't
show in the macros list.

They do show in the Excel functions list, under the category User Defined.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Back
Top