Hello Group;
Please help with my problem.
Thanks,
Chet
I have a workbook which contains 2 sheets, I have 3 macro's which clear contents of selected cells in each sheet, another Module1 to reset check boxes in sheet 2. Each macro works when run in macros on the developer menu.
I have a button on sheet1 I want to use to run the 3 macros. Each macro runs when assigned individually to the button. The macro called Main_Macro MoDule2 is setup to run the 3 macros from the sheet1 button. I've sen examples of this process using cal and sub plus the macro name.
When using the example below I get a compile error "expected end sub"
When using cal I get compile error "sub or function not defined"
Sub Main_Macro()
Sub ClearCheckBoxes() 'Macro1
Sub ClearMyRange() 'Macro2
Sub ClearMyRange2() 'Macro3
End Sub
Sub clearcheck()
Dim sh As Worksheet
For Each sh In Sheets
On Error Resume Next
sh.CheckBoxes.Value = False
On Error GoTo 0
Next sh
End Sub
Sub ClearMyRange()
'
' ClearMyRange Macro
' Sub ClearMyRange
Range("C3:AA64 ").ClearContents
Range("A2 ").ClearContents
End Sub
Sub ClearMyRange2()
'
' ClearMyRange Macro
' Sub ClearMyRange
Range("B6:K10 ").ClearContents
Range("E21:E22 ").ClearContents
Range("E24:E25 ").ClearContents
Range("G23:I23 ").ClearContents
Range("B30:G37 ").ClearContents
Range("B53:K57 ").ClearContents
Range("D51 ").ClearContents
Range("F51 ").ClearContents
Range("B70:K77 ").ClearContents
Range("H44:K49 ").ClearContents
Range("C42:F42 ").ClearContents
Range("H30:K37 ").ClearContents
End Sub '
Please help with my problem.
Thanks,
Chet
I have a workbook which contains 2 sheets, I have 3 macro's which clear contents of selected cells in each sheet, another Module1 to reset check boxes in sheet 2. Each macro works when run in macros on the developer menu.
I have a button on sheet1 I want to use to run the 3 macros. Each macro runs when assigned individually to the button. The macro called Main_Macro MoDule2 is setup to run the 3 macros from the sheet1 button. I've sen examples of this process using cal and sub plus the macro name.
When using the example below I get a compile error "expected end sub"
When using cal I get compile error "sub or function not defined"
Sub Main_Macro()
Sub ClearCheckBoxes() 'Macro1
Sub ClearMyRange() 'Macro2
Sub ClearMyRange2() 'Macro3
End Sub
Sub clearcheck()
Dim sh As Worksheet
For Each sh In Sheets
On Error Resume Next
sh.CheckBoxes.Value = False
On Error GoTo 0
Next sh
End Sub
Sub ClearMyRange()
'
' ClearMyRange Macro
' Sub ClearMyRange
Range("C3:AA64 ").ClearContents
Range("A2 ").ClearContents
End Sub
Sub ClearMyRange2()
'
' ClearMyRange Macro
' Sub ClearMyRange
Range("B6:K10 ").ClearContents
Range("E21:E22 ").ClearContents
Range("E24:E25 ").ClearContents
Range("G23:I23 ").ClearContents
Range("B30:G37 ").ClearContents
Range("B53:K57 ").ClearContents
Range("D51 ").ClearContents
Range("F51 ").ClearContents
Range("B70:K77 ").ClearContents
Range("H44:K49 ").ClearContents
Range("C42:F42 ").ClearContents
Range("H30:K37 ").ClearContents
End Sub '