Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Can someone tell me why this code fails? It triggers the MsgBox. The contents of cell AB1 is =TEXT(B4,"dd mmm yy"). Also what format should be given to cell AB1? Sub Rename_Worksheets() ' ' Macro1 Macro ' Macro recorded 12/19/2005 by Cathy Baker ' ' 'This code runs to rename the worksheets Dim wks As String Dim Sh As Worksheet wks = ActiveSheet.Name Const sStr As String = "AB1" On Error GoTo ErrHandler For Each Sh In ThisWorkbook.Worksheets Sh.Name = Sh.Range(sStr).Value Next Sh Worksheets(wks).Activate Exit Sub ErrHandler: MsgBox "Cell" & sStr & "on sheet" & sh.Name & "is not valid sheet name" Resume Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Run VBA code only worksheet change, but don't trigger worksheet_change event based on what the code does | Excel Programming | |||
Shorten code to apply to all sheets except a few, instead of individually naming them, and later adding to code. | Excel Programming | |||
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... | Excel Programming | |||
Excel code convert to Access code - Concat & eliminate duplicates | Excel Programming |