worksheet renames - specific

Joined
Oct 10, 2013
Messages
1
Reaction score
0
I'm trying to rename worksheets 4-34 in an Excel 2010 file. The name list can be found on worksheet 2 named Initial Input (if that is relivant) in b2:31. I came a cross this at this forum and made some minor modifcations:

Sub namesheets()
Dim arr As Variant
arr = Range("b2:b31").Value
For i = LBound(arr) To UBound(arr)
Sheets(i + 1).Activate
Sheets(i).Name = arr(i,1)
Next i
End Sub

It works with the exception of...

(1) I want it to start naming on worksheet 4, not worksheet 1.
(2) I get an error code after it runs out of names so I assume it needs some type of "get out of loop" function but I don't know how to build it in.

I know just enough to be dangerous so if someone could help me that would be awesome!

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top