I've got an excel spreadsheet I'm writing a macro for to process some data files. I have it set up so it prompts the user for a number of data files, then the macro loops through them copying/pasting data to the spreadsheet.
I want it to also number the rows, starting with A2 and going down. This is the code I'm using right now in a test module (it will get integrated into the main module when I get it working).
I have a column heading in A1 ("Run") and nothing in A2. The macro will not run, however if I add something to A2, the macro runs fine.
I've also tried this line instead of the Range statement:
Columns("A").Cells.SpecialCells(xlCellTypeBlanks).Cells(1).Select
But that line errors out at me saying there's no empty cells in column A. That line is working fine when I refer to column B for another part of the macro.
Any ideas? I want to go to the first empty cell in column A, as simply as possible.
Thanks!
Edit: It works with this line of code:
Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Select
I want it to also number the rows, starting with A2 and going down. This is the code I'm using right now in a test module (it will get integrated into the main module when I get it working).
Dim Row As Long
For Row = 1 To 4
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveCell.FormulaR1C1 = Row
I have a column heading in A1 ("Run") and nothing in A2. The macro will not run, however if I add something to A2, the macro runs fine.
I've also tried this line instead of the Range statement:
Columns("A").Cells.SpecialCells(xlCellTypeBlanks).Cells(1).Select
But that line errors out at me saying there's no empty cells in column A. That line is working fine when I refer to column B for another part of the macro.
Any ideas? I want to go to the first empty cell in column A, as simply as possible.
Thanks!
Edit: It works with this line of code:
Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Select