Hello,
I'm writing a macro that collects data from one workbook (the source) and writes it row by row to another (the destination). I'd like for it to be able to be run when data already exists in the destination, and automatically find the first empty row and start appending data there. Every now and again the user will cut some data out of the destination workbook. I'd like for my macro to recognize that the cells where the data once was are now empty, and so write over them.
Currently I'm using the call:
I then write data via statements such as:
The problem is that the macro won't recognize if data has been deleted. For instance, if there is data in the destination worksheet in rows 1 through 7, then the data in rows 6 and 7 gets "cut" out of that worksheet, and then the macro is run again... it starts appending at row 8 even though row 6 is the first empty row.
How can I get the macro to recognize the cleared cells?
thank you.
jay
I'm writing a macro that collects data from one workbook (the source) and writes it row by row to another (the destination). I'd like for it to be able to be run when data already exists in the destination, and automatically find the first empty row and start appending data there. Every now and again the user will cut some data out of the destination workbook. I'd like for my macro to recognize that the cells where the data once was are now empty, and so write over them.
Currently I'm using the call:
Code:
RowToAppendTo = Cells.SpecialCells(xlCellTypeLastCell).row + 1
Code:
Cells(RowToAppendTo, 2).Value = MyData
The problem is that the macro won't recognize if data has been deleted. For instance, if there is data in the destination worksheet in rows 1 through 7, then the data in rows 6 and 7 gets "cut" out of that worksheet, and then the macro is run again... it starts appending at row 8 even though row 6 is the first empty row.
How can I get the macro to recognize the cleared cells?
thank you.
jay