I have a workbook with lots of sheets, I'm only interested in a subset of sheet names. These I entered into a worksheet called MacroInfo in the same workbook. I want to loop through each worksheet and if it's name is one of the subset then do something.
I have this code for a fixed set of sheet names
Dim ws As Worksheet
Dim thisWB As Workbook
Set thisWB = ThisWorkbook
For Each ws In thisWB.Worksheets
Select Case (ws.Name)
' Only interested in searching worksheets with these names
Case "GPT", "Portables", "Fixed systems", "I&C", "Probes and Cables", "Retro Bundles", "Software", "Parts & Svc"
'Do something
End Select
Next ws
Now, trying to get the sheet names dynamically from the MacroInfo worksheet
Dim sheetNames As Variant
sheetNames = thisWB.Worksheets("MacroInfo").Range("G1:G" & thisWB.Worksheets("MacroInfo").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row).Value
For i = LBound(sheetNames) To UBound(sheetNames)
Debug.Print sheetNames(i)
Next i
But I get nothing. Even when I hard code the range to "G1:G8"
Any ideas what I'm doing wrong?
Thanks
Bookmarks