![]() |
Custom List to Define Sheet Tab Names
Would like to use a custom list, or a range name, or simply a range with
names to define my worksheet names via VBA; can do? -- Marv Lusk Boise Corporation |
Custom List to Define Sheet Tab Names
Sub tester()
Dim iWS As Integer Dim rNames As Range Set rNames = Range("myNames") For iWS = 1 To rNames.Count Worksheets(iWS).Name = rNames(iWS) Next iWS End Sub (no error trapping) HTH -- AP "MarvInBoise" a écrit dans le message de news: ... Would like to use a custom list, or a range name, or simply a range with names to define my worksheet names via VBA; can do? -- Marv Lusk Boise Corporation |
Custom List to Define Sheet Tab Names
Marv,
Here is one way. In this example, I have assumed that the first item in the list is TabNames, so that we can pinpoint the list Dim i As Long, j As Long Dim ary For i = 1 To Application.CustomListCount ary = Application.GetCustomListContents(i) If ary(LBound(ary)) = "TabNames" Then For j = 2 To UBound(ary) If j - 1 <= ActiveWorkbook.Worksheets.Count Then Worksheets(j - 1).Name = ary(j) End If Next j End If Next i -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "MarvInBoise" wrote in message ... Would like to use a custom list, or a range name, or simply a range with names to define my worksheet names via VBA; can do? -- Marv Lusk Boise Corporation |
Custom List to Define Sheet Tab Names
Perfect! Thanks so much!
-- Marv Lusk Boise Corporation "Ardus Petus" wrote: Sub tester() Dim iWS As Integer Dim rNames As Range Set rNames = Range("myNames") For iWS = 1 To rNames.Count Worksheets(iWS).Name = rNames(iWS) Next iWS End Sub (no error trapping) HTH -- AP "MarvInBoise" a écrit dans le message de news: ... Would like to use a custom list, or a range name, or simply a range with names to define my worksheet names via VBA; can do? -- Marv Lusk Boise Corporation |
All times are GMT +1. The time now is 08:43 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com