ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Name all Sheets except first one from a list (https://www.excelbanter.com/excel-programming/426391-name-all-sheets-except-first-one-list.html)

K[_2_]

Name all Sheets except first one from a list
 
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

Jacob Skaria

Name all Sheets except first one from a list
 
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
---------------
Jacob Skaria


"K" wrote:

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


Jacob Skaria

Name all Sheets except first one from a list
 
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


"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"K" wrote:

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


K[_2_]

Name all Sheets except first one from a list
 
On 2 Apr, 13:24, Jacob Skaria
wrote:
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



"Jacob Skaria" wrote:
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
---------------
Jacob Skaria


"K" wrote:


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- Hide quoted text -


- 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

Dominik Petri

Name all Sheets except first one from a list
 
K schrieb:
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).valu e

Next iSheetCounter

Hope this helps,
Dominik.

Jacob Skaria

Name all Sheets except first one from a list
 
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
---------------
Jacob Skaria


"K" wrote:

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



All times are GMT +1. The time now is 07:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com