BettyBoop0916
New Member
- Joined
- May 20, 2011
- Messages
- 16
Hi there,
I need help in producing a macro button to insert cells from a sheet entitled data to a new sheet. Now, this button has to work on any new sheet I create.
For example, I have my workbook set up as such:
Sheet 1: Data
Sheet 2: Template
Sheet 3: New
Sheet 4: New
Sheet 5: New
And so on...
Now, when I copy the template sheet (which has the macro button on it), I want the macro button to still be able to be used to insert those cells.
But I stumble, because the only way I was able to set this up was as such:
Private Sub CommandButton2_Click()
Sheets("Data").Select
Sheets("Data").Range("C1:I5").Select
Selection.Copy
Sheets("Template").Select
Selection.Insert Shift:=xlDown
End Sub
But as you see, I've had to select only Template when I select the sheets. I need to be able to make it so that where I've placed "Template", I can place something to the effect of any new sheet created.
Does this make sense?
Can someone help on this subject?
I need help in producing a macro button to insert cells from a sheet entitled data to a new sheet. Now, this button has to work on any new sheet I create.
For example, I have my workbook set up as such:
Sheet 1: Data
Sheet 2: Template
Sheet 3: New
Sheet 4: New
Sheet 5: New
And so on...
Now, when I copy the template sheet (which has the macro button on it), I want the macro button to still be able to be used to insert those cells.
But I stumble, because the only way I was able to set this up was as such:
Private Sub CommandButton2_Click()
Sheets("Data").Select
Sheets("Data").Range("C1:I5").Select
Selection.Copy
Sheets("Template").Select
Selection.Insert Shift:=xlDown
End Sub
But as you see, I've had to select only Template when I select the sheets. I need to be able to make it so that where I've placed "Template", I can place something to the effect of any new sheet created.
Does this make sense?
Can someone help on this subject?