Name all Sheets except first one from a list

K

K

Hi all, I have sheet names in Range("A3:A13") of Sheet1 and I have 11
sheets in a workbook. I want macro on a button which should give
names to all sheets except the first sheet or Sheet1 by looking in
Range("A3:A10") of Sheet1. Please can any friend can help
 
J

Jacob Skaria

Sub NameWorksheets()
Dim intTemp
For intTemp = 2 To ActiveWorkbook.Sheets.Count
ActiveWorkbook.Sheets(intTemp).Name = ActiveWorkbook.Sheets(1).Range("A" &
intTemp + 1)
Next
End Sub

If this post helps click Yes
 
J

Jacob Skaria

You need to have 10 sheet names
The range should be Range("A3:A12") and not Range("A3:A10")


If this post helps click Yes
 
K

K

You need to have 10 sheet names
The range should be Range("A3:A12") and not Range("A3:A10")

If this post helps click Yes
---------------
Jacob Skaria







- Show quoted text -

Hi jacob, Thanks for replying. sorry i didnt understant your answer.
basically i have 11 sheets in workbook and i want macro to name 10
sheets from range("A3:A12") leaving the sheet1
 
D

Dominik Petri

K said:
Hi all, I have sheet names in Range("A3:A13") of Sheet1 and I have 11
sheets in a workbook. I want macro on a button which should give
names to all sheets except the first sheet or Sheet1 by looking in
Range("A3:A10") of Sheet1. Please can any friend can help


Hi,
if you have names in A3:A13 that's 11 names
If your workbook has 11 sheets and you want to rename all but the first
one, you only have 10 sheets you want to rename. Why 11 names in 11 cells?

This should get you started (watch out for wordwrap):

For iSheetCounter = 2 to activeworkbook.Sheets.Count

Activeworkbook.Sheets(iSheetCounter).Name =
Worksheets("Sheet1").Cells(iSheetCounter+1,1).value

Next iSheetCounter

Hope this helps,
Dominik.
 
J

Jacob Skaria

I have posted the answer in my first reply itself. I was mentioning that
instead of ("A3:A12") you have give ("A3:A10").....Try this and feedback.

Sub NameWorksheets()
Dim intTemp
For intTemp = 2 To ActiveWorkbook.Sheets.Count
ActiveWorkbook.Sheets(intTemp).Name = ActiveWorkbook.Sheets(1).Range("A" &
intTemp + 1)
Next
End Sub


If this post helps click Yes
 

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