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

Closed
ruincontrl Posts 1 Registration date Tuesday February 7, 2017 Status Member Last seen February 7, 2017 - Updated by Ambucias on 7/02/17 at 04:15 PM
vcoolio Posts 1404 Registration date Thursday July 24, 2014 Status Moderator Last seen September 15, 2023 - Feb 9, 2017 at 04:42 AM
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
Related:

1 response

vcoolio Posts 1404 Registration date Thursday July 24, 2014 Status Moderator Last seen September 15, 2023 259
Feb 9, 2017 at 04:42 AM
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.
0