Hello, I have this code which formats specific cells on specific sheets, it works fine but when I use the Option Explicit argument if does not compile. How can I rewrite it so it compiles with Option Explicit? - Thanks.
Sub Format_Specific_Sheets()
On Error GoTo ErrHandler:
Sheetlist = Array("Hoja1", "Sheet1", "Sheet3", "Sheet4", "Sheet5") 'Define sheet names, to format
For i = LBound(Sheetlist) To UBound(Sheetlist)
Worksheets(Sheetlist(i)).Activate
' Your Code Goes Here
Range("F4:I8").Select
Range("I8").Activate
Selection.Font.Bold = True
Next
ErrHandler:
If Err.Number = 9 Then 'Sheet does not exist
MsgBox "No more sheets fullfill the criteria. All operations completed succesfully", vbInformation, "Done"
Else
MsgBox "Error " & Err.Number & " (" & Err.Description & ")", vbInformation, "Humm..."
Exit Sub
End If
End Sub
Bookmarks