Hi,
Its clear that I am still a newbie...
In VBA, how do I assign a value to a cell with out first selecting the cell?
In pseudo code I would describe it as "Assign the value 5 to the cell in
location x".
Kind regards
George
Don Guillett - 23 Jan 2006 14:02 GMT
try
cells(1,5)=5
or
range("a5")=5

Signature
Don Guillett
SalesAid Software
dguillett1@austin.rr.com
> Hi,
>
[quoted text clipped - 8 lines]
>
> George
Tushar Mehta - 23 Jan 2006 14:07 GMT
In the simplest form: Cells({row},{column}).value=5
More explicitly: Worksheets({worksheet id}).Cells({row},{column}).value=5

Signature
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
> Hi,
>
[quoted text clipped - 7 lines]
>
> George
George Furnell - 23 Jan 2006 14:16 GMT
Thank you, thats what I was looking for.
Kind regards
George
Bob Phillips - 23 Jan 2006 14:11 GMT
Range("A1").Value = 1
It is also good practice to reference the workbook and worksheet
With Activeworkbook
With .Worksheets("Sheet1")
.Range("A1").Value = 5
...
End With
End With
note the leading dots
--
HTH
Bob Phillips
(remove nothere from the email address if mailing direct)
> Hi,
>
[quoted text clipped - 7 lines]
>
> George