Macro: Coding Macro to Select, Cut and Paste Row from one sheet to another (Excel 2010)

Sppinner

New Member
Joined
May 6, 2013
Messages
20
Hello! I am needing to code a macro that can select a row of information, cut it and then paste it into a different (already labeled) sheet. To elaborate I would like to select cut the information from "Sheet 1" and then paste it into "Sheet 2" in an identical format without pasting over any rows that are already present. To give an example, I would like to select and cut the following row:
Name
Address
Phone Number
Male/Female
Simpson, OJ
123 Glove Fit Road
(110) 495-4830
Male

<tbody>
</tbody>
And then paste it into a different sheet so that it looks like this:
Name
Address
Phone Number
Male/Female
Winehouse, Amy
423 Rehab Cres.
(375) 836-8463
Female
Brown, James
395 Feel Good Way
(576) 846-3976
Male
Bonds, Barry
923 Roid and Run Street
(458) 747-4856
Male
Simpson, OJ
123 Glove Fit Road
(566) 846-4854
Male

<tbody>
</tbody>
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
hi and welcome to Mr Excel Board
something like below ( it will cut activerow and paste to sheet 2 )
Code:
Sub Test()
ActiveCell.EntireRow.Cut Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End Sub
 
Upvote 0
Thanks Keva! It worked perfectly! In regards to your code, I understand what most of it is saying but I am a bit unsure about what the "End.(x1Up) and Offset (1,0)" functions actually mean. Would you be ok with elaborating them for me? I'm new to Macros and am trying to learn as much as I can!
 
Upvote 0
"End(Xlup)" means Range("A" & Rows.Count) = A and how many rows in excel sheet suppose its 2007 and later 1048576 so Range("A1048576") select and from that to go up and when found and nonblank cell then stop so suppose nonblank cell is A11 so it will select A11 but i want to paste data in A12(next blank cell) so offset (1,0) means that select row A12 if you put there offset(2,0) it will select A13

if you want to learn more then make one test workbook and make changes in code and see what happen thats better to learn

Hope you understand this
 
Upvote 0

Forum statistics

Threads
1,215,734
Messages
6,126,543
Members
449,316
Latest member
sravya

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