View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
pascal baro pascal baro is offline
external usenet poster
 
Posts: 23
Default writing a value to a particular cell from function

yes, you can use a function to perform like a sub in vba. The difference with a sub is that the function should a return a value...

On Wednesday, July 25, 2012 8:55:14 AM UTC+1, joeu2004 wrote:
"Spint" > wrote:
> is there any way i can return a value from the function
> and also inside the function some calculated value to be
> set to particular cell.

No, not in a VBA function per se. You could do that in a VBA sub(routine),
but not one that is invoked by an Excel calculation (through a VBA function)
directly or indirectly.

Generally, Excel does not permit a VBA function to change the state of Excel
worksheets directly or indirectly. There are some exceptions, corner-cases
really. I don't remember them off-hand.