Identify Last Cell and autofill last column
On Sep 21, 9:00 am, manfareed
wrote:
Hi,
I have a spreadsheet for which I need to identify the last cell with data
[nos. or formula] and on the column to the right I need to autofill with row
nos. Row numbering should stop when the row with the last cell is reached. Eg
if data is to row 672 only then the row number should be "numbered" as 672.
Thanks,
Manir
Hello Manir,
Not sure if this what you are looking. This code example finds the
last row in column "A" and then fills each cell in column "B" with the
row number.
Dim LastRow As Long
Dim R As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For R = 1 To LastRow
Cells(R, "B").Value = R
Next R
Sincerely,
Leith Ross
|