Macros write a macro from sheet 1 to copy data when selected [Closed]

Report
Posts
1
Registration date
Tuesday February 7, 2017
Status
Member
Last seen
February 7, 2017
-
Posts
1260
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
February 3, 2020
-
Good Afternoon-

I am new to writing Macros, and would appreciate some help. I want to write a macro from sheet 1 to copy data when selected to sheet 2 and deleted from sheet 1. And would like when I select the next data that it is placed under the prior information on sheet 2.

Would like to start at Column A row 16 and copy over to Column Q row 16. Select this data in sheet 1 and copy to sheet 2, then delete it from sheet 1. When I select the next data to be moved that it place right under the prior selection in sheet 2. Thank you

1 reply

Posts
1260
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
February 3, 2020
213
Hello Ruincontrl,

Try the following code in a standard module assigned to a button:-


Sub TransferData()

Dim Confirm As String

Confirm = MsgBox("The selected row will be copied to Sheet2 and deleted from Sheet1.", vbOKCancel, "Copy Entire Row")

If Confirm = vbCancel Then Exit Sub

Selection.Copy Sheet2.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Selection.EntireRow.Delete

MsgBox "Data transfer complete!", vbExclamation
Sheet2.Select

End Sub



Select the row of data that you wish to transfer to Sheet2 then click on the button and that row will be transferred to Sheet2 and deleted from Sheet1.

I hope that this helps.

Cheerio,
vcoolio.

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!