V
vrzimmerm
I am adding a record number into column A of a data matrix, and the
number of rows in the matrix varies. I have the following code to do
this:
With Worksheets("WorksheetName")
For i = 2 To .Range("B65536").End(xlUp).Row
Cells(i, 1).Value = i - 1
Next i
End With
My problem is the the macro just added the worksheet where the data
exists, so I don't know it's name. Since this macro is iterative and
creates several such sheets the worksheet name keeps changing. How
do I make this macro work when the worksheet name is different every
time?
Thanks for the help.
number of rows in the matrix varies. I have the following code to do
this:
With Worksheets("WorksheetName")
For i = 2 To .Range("B65536").End(xlUp).Row
Cells(i, 1).Value = i - 1
Next i
End With
My problem is the the macro just added the worksheet where the data
exists, so I don't know it's name. Since this macro is iterative and
creates several such sheets the worksheet name keeps changing. How
do I make this macro work when the worksheet name is different every
time?
Thanks for the help.