I have inherited a help ticket to solve error issues within an Excel Macro document. I receive the error "Runtime Error 438: Object doesn't support this property or method", when the first code group listed below is run. After making a small syntax change I receive the error "Compile error: Next without For", when the second code group listed below is run. I have tried a few possibly fixes but I cannot shake these errors. Any help is appreciated.
Private Sub Worksheet_Change(ByVal target As Range)
Dim TabNum As Long
' Check all automation boxes on all of the tabs when Master is selected
If Range("Master") = "Master" Then
For TabNum = 7 To 23 Step 1 'thisworkbook.Sheets.Count is the number of tabs in the open master SIG
ThisWorkbook.Worksheets(TabNum).Select
If ThisWorkbook.Worksheets(TabNum).CheckBox1.Value = False Then ThisWorkbook.Worksheets(TabNum).CheckBox1.Value = True
Next TabNum
End If
' move back to the formula notes worksheet
ThisWorkbook.Worksheets(27).Select
End Sub
Private Sub Worksheet_Change(ByVal target As Range)
Dim TabNum As Long
' Check all automation boxes on all of the tabs when Master is selected
If Range("Master") = "Master" Then
For TabNum = 7 To 23 Step 1 'thisworkbook.Sheets.Count is the number of tabs in the open master SIG
ThisWorkbook.Worksheets(TabNum).Select
If ThisWorkbook.Worksheets(TabNum).CheckBox1.Value = False Then
ThisWorkbook.Worksheets(TabNum).CheckBox1.Value = True
Next TabNum
End If
' move back to the formula notes worksheet
ThisWorkbook.Worksheets(27).Select
End Sub