Archive of Mr Excel Message Board
Here's the function:
Public Function aa()
Cells(5, 1).Value = 999
aa = 0
End Function
It always returns a #VALUE error when called.
If I comment out the Calls statement, it returns 0
this is excel 2000
I've tried samples directly from the help files, and always get the #VALUE error when trying to set the contents of a cell
Gary

| Check out our Excel Resources | ||||
![]() |
![]() |
|||
if you want the cell to have the formula "=aa()":
Public Function aa()
aa=999
end function
You should not try to stuff a cell with a command in a function; all a function can do is return a value that will substituted for the function call in the cell's formula.
The cells(5,1)=999 command belongs in a SUB, not a function.
Or am I missing something?
