Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am striving to build a VBA macro that will numeber and re-number m
worksheets by putting numbers before the name of each worksheet. ( find this easiest for referring to them in training, documenataion, an verbal instructions, e.g. "Go to worksheet '17.Q4 Sales') Below is what I have so far, but I need to enhance it to accomplish th following: If there is a period found at the within the first 5 characters of th worksheet name, delete numbers found to LEFT of that period and replac with appropriate sequential number. This below works, but obviously adds another number every time it i run. (Code may be recognized as being based someone else's code t re-order worksheets or rename.) Sub NumberWorksheets() Dim iCtr As Long For iCtr = 1 To Worksheets.Count On Error Resume Next Worksheets(iCtr).Name = iCtr & Worksheets(iCtr).Name If Err.Number < 0 Then MsgBox "Trouble with " & Worksheets(iCtr).Name Err.Clear End If Next iCtr End Sub TI -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
number of worksheets | Excel Discussion (Misc queries) | |||
Number of worksheets | Excel Discussion (Misc queries) | |||
maximum number of worksheets | Excel Worksheet Functions | |||
Number of worksheets | Excel Discussion (Misc queries) | |||
Default number of worksheets | Excel Programming |