PDA

View Full Version : Simple VBA Statement



robertsa123
03-06-2013, 07:33 AM
Hi,

I'm trying to fill the values of all row numbers down the first column of an excel spreadsheet. I want to start at row 1 and finish on the very bottom row (the limit). Could anyone help me with this please?

Thanks in advance,

Adam

Bob Phillips
03-06-2013, 07:42 AM
Do you mean like this

Range("A1").Value = 1
Range("A2").Value = 2
Range("A1:A2").AutoFill Destination:=Range("A1").Resize(Rows.Count)

robertsa123
03-06-2013, 07:57 AM
Yes that is sort of what i mean thanks. Is it possible to do that for the first 9 columns without changing the code too much?

Thanks very much

Adam

Bob Phillips
03-06-2013, 08:01 AM
Range("A1").Resize(, 9).Value = 1
Range("A2").Resize(, 9).Value = 2
Range("A1:A2").Resize(, 9).AutoFill Destination:=Range("A1").Resize(Rows.Count, 9)