Hi all,
First timer here. I am given a workbook with hundreds of sheets with different names - air(2),air(4), ground(4), ground(28),ground(6), etc. I need to keep the text of the name but change the number associated with it. -air(1),air(2), ground(3), ground(4),ground(5). I am trying to consecutively number tabs without changing the text then add the number in a cell on that sheet. The renaming part of the following code seems to work, but- If Sheets(i).Name= "whatever" doesn't. Your help would be appreciated.
![]()
Sub Search_Rename() Dim i As Long For i = 1 To Worksheets.Count i = i + 1 If Sheets(i ).Name = air(n) Then Sheets(i ).Name = Sheets(i).Name = "air(" & i & ")" 'This line I can't figure out syntax for if statement air(n) Cell(3,4)=i If Sheets(i ).Name = Gound(n) Then Sheets(i ).Name = Sheets(i).Name = "ground(" & i & ")" 'This line I can't figure out syntax for if statement ground(n) Cell(8,9)=i Next i End Sub
Bookmarks