Macro code to copy and past in new sheet last row of data

[Closed]
Report
-
Posts
1316
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
August 21, 2021
-
Hello,

I'm trying to write a simple macro to copy in one sheet a selected amount of column data (which varies by size each time) and then paste the data in another sheet in the last available row. I do this three different times for three different selections in the first sheet, which each go into a separate column in the second sheet. I have the below code so far, but when I run it, it freezes my excel and I need to force restart. I think the problem lies when I try to select the last available cell in my data set.

Range("A3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Master Table").Select
lastRow = Cells(Rows.Count, "B").End(xlUp).Row
Range("B" & lastRow + 1).Select
ActiveSheet.Paste

Any help would be appreciated.

1 reply

Posts
1316
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
August 21, 2021
238
Hello Arg,

Just so that we can fully understand your requirements, could you please upload a sample of your work book (be careful with any sensitive data) showing the inputs and the expected result. You can upload a sample by using a free file sharing site such as DropBox or ge.tt.

Someone should then be able to sort this out for you.

Cheerio,
vcoolio.