Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding values to multiple cells

Status
Not open for further replies.

Luis939

MIS
Feb 28, 2003
453
0
0
US
is there anyway of adding one value to 2 or more cells, all in the same line

I'd like to say cell A1 and cell A2 = myvalue

is there anyway of doing that, or must i repeat that instruction for each cell
 
Hello 4335,
You have the For Loop option:

For i = 1 To 2 'Indicates the row number
Cells(i, 1).Value = Myvalue
Next i

tony813

Tony813
 
If you are adding to the cells (as you say in the subject), then tony813 gave you the answer.

On the other hand if you are initializing the cells (as you indicated in your example) then you can use this to set (not add) all of the cells in a range at once:
[blue]
Code:
  Range("A1:A2") = 42
[/color]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top