Copy Selected Data and Paste to the Last Row of Another Sheet

Saravana

New Member
Joined
Jan 8, 2020
Messages
4
Office Version
  1. 2016
Platform
  1. Web
Have one row in "Copy" sheet and 2 rows in "Master" sheet.
In Master sheet after the last row i mean in 3rd row want the data present from A1 to S column to be pasted from Copy sheet.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Welcome to the forum
Try this VBA solution
VBA Code:
Sub CopyRow()
    Sheets("Master").Range("A1:S1").Copy Sheets("Copy").Range("A" & Rows.Count).End(xlUp).Offset(1)
End Sub

For values to be pasted
VBA Code:
    Sheets("Master").Range("A1:S1").Copy
    With Sheets("Copy").Range("A" & Rows.Count).End(xlUp).Offset(1)
        .PasteSpecial (xlPasteAll)
        .PasteSpecial (xlPasteValues)
    End With
 
Upvote 0
Oops :oops:
I missed your "Selected Data" constraint because it is in the title but not in the detail in post#1

This copies columns A:S for all selected rows to sheet "Copy"
Selecting one cell in any column is sufficient

VBA Code:
Sub CopyActiveRow()
    Range("A1:S1").Offset(ActiveCell.Row - 1).Resize(Selection.Rows.Count).Copy
    With Sheets("Copy").Range("A" & Rows.Count).End(xlUp).Offset(1)
        .PasteSpecial (xlPasteAll)
        .PasteSpecial (xlPasteValues)
    End With
End Sub
 
Upvote 0
Master is source sheet which has 2 rows
Copy is the new data which has 1 row (may also have many rows , it should copy till last row and then append to last row to Master sheet) , need to insert this row to Master sheet as a third row. Can you explain as i am new to macro
 
Upvote 0
this will copy FROM sheet COPY to sheet Master
VBA Code:
Sub CopyActiveRow()
    Range("A1:S1").Offset(ActiveCell.Row - 1).Resize(Selection.Rows.Count).Copy
    With Sheets("Master").Range("A" & Rows.Count).End(xlUp).Offset(1)
        .PasteSpecial (xlPasteAll)
        .PasteSpecial (xlPasteValues)
    End With
End Sub
 
Upvote 0
Can you explain the above code and where you have mentioned the sheet name ("Copy").
 
Upvote 0
where you have mentioned the sheet name ("Copy").
Rows being selected by user are on sheet "copy"
So sheet "Copy" is the active sheet
(Unless qualified with a sheet reference) ranges automatically refer to the active sheet
Range("A1:S1").Offset(ActiveCell.Row - 1).Resize(Selection.Rows.Count).Copy

VBA Code:
Sub CopyActiveRow()
'The active cell is the FIRST cell in a selected range
'with range A6:A8 selected, ActiveCell =A6
'ActiveCell.Row is the row number of that cell = 6
'Selection.Rows.Count = the count of rows in the selected range = 3  (rows 6,7,8)
'A1:S1 is offset by 5 rows ( ie ActiveCell.Row 6 MINUS 1 = 5)  = A6:S6
'A6:S6 is then resized to 3 rows = A6:S8
' that range is copied
    Range("A1:S1").Offset(ActiveCell.Row - 1).Resize(Selection.Rows.Count).Copy
'standard technique to find last cell in column A and then offseting by one row
' same as putting cusor in cell A1048576 followed by {END}{UP arrow}{DOWN arrow}
    With Sheets("Master").Range("A" & Rows.Count).End(xlUp).Offset(1)
'paste everything including formula
        .PasteSpecial (xlPasteAll)
'overwrite with values
        .PasteSpecial (xlPasteValues)
    End With
End Sub
 
Upvote 0
Rows being selected by user are on sheet "copy"
So sheet "Copy" is the active sheet
(Unless qualified with a sheet reference) ranges automatically refer to the active sheet
Range("A1:S1").Offset(ActiveCell.Row - 1).Resize(Selection.Rows.Count).Copy

VBA Code:
Sub CopyActiveRow()
'The active cell is the FIRST cell in a selected range
'with range A6:A8 selected, ActiveCell =A6
'ActiveCell.Row is the row number of that cell = 6
'Selection.Rows.Count = the count of rows in the selected range = 3  (rows 6,7,8)
'A1:S1 is offset by 5 rows ( ie ActiveCell.Row 6 MINUS 1 = 5)  = A6:S6
'A6:S6 is then resized to 3 rows = A6:S8
' that range is copied
    Range("A1:S1").Offset(ActiveCell.Row - 1).Resize(Selection.Rows.Count).Copy
'standard technique to find last cell in column A and then offseting by one row
' same as putting cusor in cell A1048576 followed by {END}{UP arrow}{DOWN arrow}
    With Sheets("Master").Range("A" & Rows.Count).End(xlUp).Offset(1)
'paste everything including formula
        .PasteSpecial (xlPasteAll)
'overwrite with values
        .PasteSpecial (xlPasteValues)
    End With
End Sub

Hi, I am trying to adapt this code to follow the same function. But I need it to actually go into a table and then select each element from the last row and copy each cell into 2 different sheets.

I have not had much luck. I loved the concept of it using the selected one but I cannot seem to be able to adapt it. Is there a way?
 
Upvote 0

Forum statistics

Threads
1,224,833
Messages
6,181,237
Members
453,026
Latest member
cknader

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top