Mschwarz31
New Member
- Joined
- Mar 9, 2018
- Messages
- 2
Hi guys,
I'm having trouble with a cut and paste macro. I used the macro recorder to cut a line from a worksheet and paste it onto another worksheet in the same workbook. I then have the macro attached to a checkbox. the problem is that when I run the macro it pastes the data onto the second worksheet at the top where I have a header, rather than in the range I designated when I recorded the macro. I've made sure to size and format the second worksheet so that it's identical to the first one. Here's the code ;
Sub Move_Data2()
'
' Move_Data2 Macro
' Cut and paste data from Sheet "Open to corresponding cells in sheet "Closed""&chr(10)&"'"&chr(10)&"' Keyboard Shortcut: Ctrl+Shift+M"&chr(10)&"'
Range("A6:K6").Select
Range("K6").Activate
Selection.Copy
Sheets("Closed").Select
Range("A6:K6").Select
Range("K6").Activate
Range("A6:K6").Select
Range("K6").Activate
ActiveSheet.CheckBoxes.Add(1078.5, 107.25, 29.25, 16.5).Select
ActiveSheet.Paste
Sheets("Open").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = ""
Selection.ClearContents
End Sub
What am I doing wrong? Thanks for any advice
I'm having trouble with a cut and paste macro. I used the macro recorder to cut a line from a worksheet and paste it onto another worksheet in the same workbook. I then have the macro attached to a checkbox. the problem is that when I run the macro it pastes the data onto the second worksheet at the top where I have a header, rather than in the range I designated when I recorded the macro. I've made sure to size and format the second worksheet so that it's identical to the first one. Here's the code ;
Sub Move_Data2()
'
' Move_Data2 Macro
' Cut and paste data from Sheet "Open to corresponding cells in sheet "Closed""&chr(10)&"'"&chr(10)&"' Keyboard Shortcut: Ctrl+Shift+M"&chr(10)&"'
Range("A6:K6").Select
Range("K6").Activate
Selection.Copy
Sheets("Closed").Select
Range("A6:K6").Select
Range("K6").Activate
Range("A6:K6").Select
Range("K6").Activate
ActiveSheet.CheckBoxes.Add(1078.5, 107.25, 29.25, 16.5).Select
ActiveSheet.Paste
Sheets("Open").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = ""
Selection.ClearContents
End Sub
What am I doing wrong? Thanks for any advice