I am trying to loop through sheets and if Sheet Name found patterns, I'd like to rename it.
Below is the code, however, it's not renaming it. However, the string pattern wasn't working. I also tried to do it via the exact name of the sheet, and still it doesn't goes into the Select Case statement
Note that, "* BE Consol" is indeed taking the spaces into consideration
For myforecastSheetsIndex = LBound(myforecastSheetsArray) To UBound(myforecastSheetsArray)
Select Case myforecastSheetsIndex
Case Is = 1
For Each wsBEIndex In Workbooks(desWBtoModify).Worksheets
Select Case wsBEIndex.Name
Case wsBEIndex.Name Like "* BE Consol"
wsBEIndex.Name = BEInputAns & " BE Consol"
Case wsBEIndex.Name Like "* BE"
wsBEIndex.Name = BEInputAns & " BE"
Case wsBEIndex.Name Like "* BE input tab"
wsBEIndex.Name = BEInputAns & " BE input tab"
Case wsBEIndex.Name Like "Forecast* BE*"
wsBEIndex.Name = "Forecast " & BEInputAns & " BE"
End Select
Next wsBEIndex
Case 2 To sheetsNeeded
'More codes here
Case Else 'Delete Sheets
'Codes to delete sheets
End Select
Next myforecastSheetsIndex
Aucun commentaire:
Enregistrer un commentaire