Reputation: 149
I want a macro to copy data from a certain cell, and copy it to a cell on another work sheet, but I'd like it to be a continuous list. I mean, copying the first cell into A2, then the next into A3, and so on. This is the code I've come up with so far, and it works to copy into cell A2, but it erases the previous data.
Option Explicit
Sub Copy_Data()
Worksheets("PremakeResults").Range("B1").Copy Worksheets("SavedResults").Range("A2")
End Sub
I have a feeling this is a fairly simple macro, but I haven't been looking for the right things on the internet. Any help would be appreciated!
EDIT
I just tried this code
Sub Copy_Data()
Worksheets("PremakeResults").Range("B1").Copy Worksheets("SavedResults").Range("A" & Worksheets("SavedResults").Cells(Worksheets("SavedResults").Rows.Count, "A").End(Xlup).Row)
End Sub
and while that will copy to the specified page, it still erases over the first entry.
Upvotes: 0
Views: 803
Reputation: 344
How about this. This finds the last row in the SavedResults sheets column A then adds one to select the next row then it sets the value here to be the same as Cell B1 in the premake results sheet
Sub Copy_Data()
Dim LastRow as Variant
LastRow = Worksheets("SavedResults").Cells(Rows.Count, "A").End(xlUp).Row + 1
Worksheets("SavedResults").Range("A" & LastRow).Value = Worksheets("PremakeResults").Range("B1").Value
End Sub
Upvotes: 1