View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default Cannot change Cell value

Remove the

Worksheets("Sheet1").Range("A1").Value = 123

A UDF cannot do anything other than return a value to the cell it's in.

--
Jim
wrote in message
ps.com...
| Hi, this gotta be something very simple that I'm missing. The
| following function is inside a module and it fails on Worksheet ...
| statement. The function returns #value
|
| Function ddddd(X As Double) As Double
|
| Worksheets("Sheet1").Range("A1").Value = 123
|
| ddddd = X + 1
|
| End Function
|
| Also Worksheets("Sheet1").Cells(1,1).Value = 123 fails in the same
| manner
|
| Thank you!
|