Production Planner
New Member
- Joined
- Apr 19, 2011
- Messages
- 15
Hi ladies and gents,
I am having trouble getting the macro for the checkboxes on my template to copy across when I make a new sheet.
I currently have a macro that copies the template for me and asks for a new name.
This works fine but the issue lies in that when a check box on the new form is checked it does not do as it does on the template sheet.
here is the code for the template check box.
The only thing I can see is that when the template is copied the code for the check box does not change the sheet name ie:Sheet12 to the number of the new sheet.
Is there anything I can do to over come this.
Any help would be appreciated.
Thanks in advance.
I am having trouble getting the macro for the checkboxes on my template to copy across when I make a new sheet.
I currently have a macro that copies the template for me and asks for a new name.
Code:
Sub Picture3_Click()
Dim sName As String
Dim wks As Worksheet
Worksheets("TEMPLATE").Copy after:=Sheets(Worksheets.Count)
Set wks = ActiveSheet
Do While sName <> wks.Name
sName = Application.InputBox _
(Prompt:="Enter new worksheet name")
On Error Resume Next
wks.Name = sName
On Error GoTo 0
Loop
Set wks = Nothing
End Sub
This works fine but the issue lies in that when a check box on the new form is checked it does not do as it does on the template sheet.
here is the code for the template check box.
Code:
Private Sub CheckBox1_Click()
With Sheet12
If CheckBox1.Value Then
Sheet12.Range("B4").Copy .Range("D4")
.Range("B4").ClearContents
End If
End With
End Sub
The only thing I can see is that when the template is copied the code for the check box does not change the sheet name ie:Sheet12 to the number of the new sheet.
Is there anything I can do to over come this.
Any help would be appreciated.
Thanks in advance.