Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I noticed this code is naming the wrong worksheet.. It assumes the newest
sheet is the one to be renamed and keeps renaming "sheet3". Any help appreciated. Public Function CopySheetAnalyst(xlSheet As Worksheet, Index) As Worksheet ' ' Macro2 Macro ' Macro recorded 7/11/2003 by SILVESC ' Dim xName As String Dim Basename As String Dim x As Long Call xlSheet.Copy(After:=Sheets(Sheets.Count)) Basename = Worksheets("CoverSheet").Range("B5").Offset(0, Index).Value xName = Basename On Error GoTo TryAgain Sheets(Sheets.Count).Name = xName On Error GoTo 0 Set CopySheetAnalyst = Sheets(Sheets.Count) Exit Function TryAgain: x = x + 1 xName = Basename & "-" & x Resume End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Worksheet renaming | Excel Discussion (Misc queries) | |||
Worksheet Renaming | Excel Discussion (Misc queries) | |||
Worksheet Renaming | Excel Worksheet Functions | |||
need help renaming a worksheet | Excel Discussion (Misc queries) | |||
Renaming the Worksheet through VBA | Excel Programming |