VBS script to copy various cells from one sheet to sheet2 in new row

Hereheis

New Member
Joined
Aug 7, 2020
Messages
7
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. MacOS
Hi all,

I'm trying to create a VBS script (noob here) that copy's various selected cells to sheet2 to the next available row. A basic example would be to select cells A1, C4 and D8 on sheet1 then copy to sheet2 to the next available row. Example the next available row is row 4 on sheet2 so the selected cells on sheet1 A1, C4 and C8 would copy to cells A4, B4 and C4 on sheet to in order. I found the below which was helpful but not quite what I need:

Copy Values to Next Empty Row

Sub CopyStuff()

Range("A1:J1").Copy

Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues

End Sub

The above works perfectly if you data on sheet1 on is in a sequence eg. A1:A8 but as soon as you change the range to something like A1, C4, C8 it copy's each cell to a new row.

Please can anyone help?

Thank you in advance
 
Why would you want to type them out? Clicking on them is much easier and less error prone.
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,215,655
Messages
6,126,054
Members
449,283
Latest member
GeisonGDC

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