Macros write a macro from sheet 1 to copy data when selected
Closed
ruincontrl
vcoolio
- Posts
- 1
- Registration date
- Tuesday February 7, 2017
- Status
- Member
- Last seen
- February 7, 2017
vcoolio
- Posts
- 1347
- Registration date
- Thursday July 24, 2014
- Status
- Moderator
- Last seen
- June 10, 2022
Related:
- Macros write a macro from sheet 1 to copy data when selected
- Run macro when sheet is selected - Guide
- Excel macro create sheet - Guide
- Please help - run macro when switching sheets ✓ - Forum - Excel
- Excel macro current sheet ✓ - Forum - Excel
- Excel macro copy sheet and rename ✓ - Forum - Excel
1 reply
vcoolio
Feb 9, 2017 at 04:42 AM
- Posts
- 1347
- Registration date
- Thursday July 24, 2014
- Status
- Moderator
- Last seen
- June 10, 2022
Feb 9, 2017 at 04:42 AM
Hello Ruincontrl,
Try the following code in a standard module assigned to a button:-
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.
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.