I am using the following code to rename worksheets
When it gets to the last worksheet I get a runtime error 9 subscript out of range on the line:![]()
Dim arr As Variant arr = Range("b:b").Value For i = LBound(arr) To UBound(arr) Sheets(i + 1).Activate Sheets(i).Name = arr(i, 1) Next i
![]()
Sheets(i + 1).Activate
The code renames every other sheet as required.
Any suggestions on how to fix the error??
Bookmarks