Hi there, I am very raw to VBA and struggling to get my head round it. Nonetheless I am trying! Your generous help and wisdom would be greatly appreciated please. As per above, I'm creating a macro to renaming a specific array of sheets using same cell reference (E1) in each. The work book needs to exclude certain sheets (in this example I've created a simple array excluding only Sheet1) and start at a specific sheet. In my working spreadhseet this would be Sheet17.Name through to Sheet66.Name.
My code is pasted below and a clever set of eyes on this would be fantastic please:
Sub RenamingSheetsRMcK()
Dim rs As Worksheet
Dim i As Long
vWSArray = Array(Sheet2.Name, Sheet3.Name, Sheet4.Name, Sheet5.Name)
For Each rs In vWSArray
If rs.Range("E1") = "" Then
i = i + 1
rs.Name = "Not used " & i
Else
rs.Name = rs.Range("E1").Text
End If
Next rs
End Sub
My code is pasted below and a clever set of eyes on this would be fantastic please:
Sub RenamingSheetsRMcK()
Dim rs As Worksheet
Dim i As Long
vWSArray = Array(Sheet2.Name, Sheet3.Name, Sheet4.Name, Sheet5.Name)
For Each rs In vWSArray
If rs.Range("E1") = "" Then
i = i + 1
rs.Name = "Not used " & i
Else
rs.Name = rs.Range("E1").Text
End If
Next rs
End Sub