BettyBoop0916
New Member
- Joined
- May 20, 2011
- Messages
- 16
Hi there,
I have this macro:
Private Sub CommandButton2_Click()
ActiveSheet.Unprotect
Worksheets("Data").Visible = True
Sheets("Data").Select
Sheets("Data").Range("C1:I6").Select
Selection.Copy
Sheets(Index).Select
Selection.Insert Shift:=xlDown
Worksheets("Data").Visible = False
ActiveSheet.Protect
End Sub
It is attached to a button, but I only want it to work if it falls under the first column in the worksheet.
How can I prohibt this macro from running if say they press the button while the cursor is selecting a cell in column 6?
As well, is there any way to assign this macro to a particular cell? Like putting the button in cell A1, then when that macro is inserted, starting in A6, etc.
Thanks!
I have this macro:
Private Sub CommandButton2_Click()
ActiveSheet.Unprotect
Worksheets("Data").Visible = True
Sheets("Data").Select
Sheets("Data").Range("C1:I6").Select
Selection.Copy
Sheets(Index).Select
Selection.Insert Shift:=xlDown
Worksheets("Data").Visible = False
ActiveSheet.Protect
End Sub
It is attached to a button, but I only want it to work if it falls under the first column in the worksheet.
How can I prohibt this macro from running if say they press the button while the cursor is selecting a cell in column 6?
As well, is there any way to assign this macro to a particular cell? Like putting the button in cell A1, then when that macro is inserted, starting in A6, etc.
Thanks!