Have workbook with worksheets that the Tab names are changed from time to time. Am trying to correct VBA code to continue to refer to the same worksheets regardless of the Tab name displayed. Have set up some test code to provide example...
From what I have read, should be able to refer to the Worksheet by it's real name not displayed name by using:
Sheets (Array("(Sheet1)", "(Sheet2)", "(Sheet3)", "(Sheet4)").Select)
This method comes up highlighting the word Sheets & message Compile Error, Invalid use of property
versus below which works but replies on sheet tab name.
Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4")).Select
Assistance with code appreciated.
Sub Clear_Test()
'
' Clear_Test Macro
'
'
Sheets (Array("(Sheet1)", "(Sheet2)", "(Sheet3)", "(Sheet4)").Select)
Sheets("(Sheet1)").Activate
Range("A1:E9").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("C15").Select
Sheets("(Sheet5)").Select
Range("B20").Select
End Sub
From what I have read, should be able to refer to the Worksheet by it's real name not displayed name by using:
Sheets (Array("(Sheet1)", "(Sheet2)", "(Sheet3)", "(Sheet4)").Select)
This method comes up highlighting the word Sheets & message Compile Error, Invalid use of property
versus below which works but replies on sheet tab name.
Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4")).Select
Assistance with code appreciated.
Sub Clear_Test()
'
' Clear_Test Macro
'
'
Sheets (Array("(Sheet1)", "(Sheet2)", "(Sheet3)", "(Sheet4)").Select)
Sheets("(Sheet1)").Activate
Range("A1:E9").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("C15").Select
Sheets("(Sheet5)").Select
Range("B20").Select
End Sub