Macro to copy selected cell, and paste selection into a new row on data table in different sheet

HuwEdgar

New Member
Joined
Oct 31, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello.

I'm trying to get a macro working that copies a single manually selected cell and pastes the contents as a new row on a single column table held on a different worksheet in the same workbook.

Any ideas?

Thanks very much.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
This macro will copy Range("A3"G3") from Sheet 1 to Sheet 2 on the first empty row in Column A.
Each time it is run, it repeats the process, pasting to the next available empty row again.

It can be edited to fit your needs.


VBA Code:
Sub Macro1()
   
    Worksheets("sheet1").Range("A3:G3").Copy
    
    Worksheets("sheet2").Cells(Rows.Count, "a").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues

    Application.CutCopyMode = False

End Sub
 
Upvote 0
This macro will copy Range("A3"G3") from Sheet 1 to Sheet 2 on the first empty row in Column A.
Each time it is run, it repeats the process, pasting to the next available empty row again.

It can be edited to fit your needs.


VBA Code:
Sub Macro1()
  
    Worksheets("sheet1").Range("A3:G3").Copy
   
    Worksheets("sheet2").Cells(Rows.Count, "a").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues

    Application.CutCopyMode = False

End Sub
Thank you. I was trying to create a new row in the table with
VBA Code:
ws.ListObjects("table1").ListRows.Add
but what you have provided creates a new row on the table, and does the job it needs to. Appreciate your help.
 
Upvote 0

Forum statistics

Threads
1,214,392
Messages
6,119,257
Members
448,880
Latest member
aveternik

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