View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Martijn[_2_] Martijn[_2_] is offline
external usenet poster
 
Posts: 7
Default VBA How do I set a value in a cell?

Lars-Inge,
Try
Worksheets("Sheet1").range("M5").value = "hello"
grtx's Martijn

"Lars-Inge Tønnessen (VJ# MVP)" <http://emailme.larsinge.com schreef in
bericht ...
Hi All Excel experts!

I'm using Excel 2003 Professional Edition.

How do I set a value in a cell from a VBA function. I can't return the

value
from the function, it must be entered from VBA code.

I have tried this line:
Range("Sheet1:M5").Value = "hello"
and:
Range("Sheet1!M5").Value = "hello"


No luck, I only get "#VALUE!" in the cell where the VBA script is running
from, and no "hello" in cell M5.


Regards,
Lars-Inge