![]() |
Rename Sheet tabs from list......
I've read every posting I could find for renaming sheet tabs, but haven't
stumbled upon a solution. I want to take a list on a worksheet and from that list (in sequential order A1-A100), rename every tab in the workbook. Is this possible? -- DanaK |
Rename Sheet tabs from list......
Sub reNameSheets()
Const listColumn As String = "A" Dim ws As Worksheet Dim SheetCount As Integer Dim listStartingRow As Long SheetCount = ActiveWorkbook.Worksheets.Count listStartingRow = 2 For Each ws In ThisWorkbook.Worksheets If ws.Name < "Sheet1" Then Worksheets(ws.Name).Name = Range(listColumn & i).Value SheetCount = SheetCount + 1 listStartingRow = listStartingRow + 1 End If Next End Sub "DanaK" wrote: I've read every posting I could find for renaming sheet tabs, but haven't stumbled upon a solution. I want to take a list on a worksheet and from that list (in sequential order A1-A100), rename every tab in the workbook. Is this possible? -- DanaK |
Rename Sheet tabs from list......
Sub reNameSheets()
Const listColumn As String = "A" Dim ws As Worksheet Dim SheetCount As Integer Dim listStartingRow As Long SheetCount = ActiveWorkbook.Worksheets.Count listStartingRow = 2 For Each ws In ThisWorkbook.Worksheets If ws.Name < "Sheet1" Then Worksheets(ws.Name).Name = Range(listColumn & listStartingRow).Value SheetCount = SheetCount + 1 listStartingRow = listStartingRow + 1 End If Next End Sub "DanaK" wrote: I've read every posting I could find for renaming sheet tabs, but haven't stumbled upon a solution. I want to take a list on a worksheet and from that list (in sequential order A1-A100), rename every tab in the workbook. Is this possible? -- DanaK |
Rename Sheet tabs from list......
Maybe something like:
Option Explicit Sub testme() Dim iRow as long with activesheet for irow = 1 to .cells(.rows.count,"A").end(xlup).row sheets(irow).name = .cells(irow,"A").value next irow end with End with This could fail if you have invalid names in column A and/or there are duplicate names or sheets with the same name already existing. Or if you don't have enough sheets! DanaK wrote: I've read every posting I could find for renaming sheet tabs, but haven't stumbled upon a solution. I want to take a list on a worksheet and from that list (in sequential order A1-A100), rename every tab in the workbook. Is this possible? -- DanaK -- Dave Peterson |
Rename Sheet tabs from list......
Fellas! Thank, thank you! It's working perfect. I am learning SO much
here....you are the best! -- DanaK "Dave Peterson" wrote: Maybe something like: Option Explicit Sub testme() Dim iRow as long with activesheet for irow = 1 to .cells(.rows.count,"A").end(xlup).row sheets(irow).name = .cells(irow,"A").value next irow end with End with This could fail if you have invalid names in column A and/or there are duplicate names or sheets with the same name already existing. Or if you don't have enough sheets! DanaK wrote: I've read every posting I could find for renaming sheet tabs, but haven't stumbled upon a solution. I want to take a list on a worksheet and from that list (in sequential order A1-A100), rename every tab in the workbook. Is this possible? -- DanaK -- Dave Peterson |
Rename Sheet tabs from list......
Most simply, and assuming the list of new sheet names is on the active sheet and that the sheets to be renamed are those in the active workbook Code: -------------------- Sub x() Dim i As Long For i = 1 To ActiveWorkbook.Sheets.Count ActiveWorkbook.Sheets(i).Name = ActiveSheet.Cells(i, "A").Text Next i End Sub -------------------- More rigorous code would first check for duplicates in the list of names, check for valid sheet names, and work around renaming sheets that have a name conflict with sheets yet to be named. -- shg ------------------------------------------------------------------------ shg's Profile: http://www.thecodecage.com/forumz/member.php?userid=13 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=27770 |
All times are GMT +1. The time now is 10:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com