Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all.
I'm attempting to create a worksheet name extraction tool and have obtained the following. Code------------------------------------------------------------------------------- Function stGetFileName() As Variant Dim nwShtNm As Worksheet Dim nwShtNm1 As String stGetFileName() = ThisWorkbook.Name 'need code to ensure that a worksheet gets named correctly. 'what I have here is not it. nwShtNm1 = stGetFileName() If Worksheet.Name = "Sum" Or "SUM" Then nwShtNm.Name = "Sum-" & nwShtNm1 ElseIf Worksheet.Name = "Summary" Then nwShtNm = "Sum-" & nwShtNm1 ElseIf Worksheet.Name = "APN" Then nwShtNm = "APN-" & nwShtNm1 End If End Function ---------------------------------------------------------------------------------------------- This is not working as hoped. I'm activating a workbook, looking for two worksheets-- Sum, or Summary, or SUM, and APN. I then want to rename those two worksheets from the book's name-- generally a 7 character string starting with "DTR-XXX" as shown above. I'm wanting to extract the last 3 digits- xxx. I've tried variations of the above, and this is as close as I've gotten thus far. the function just bounces back and forth between the function's name, and the stGetFileName() = ThisWorkbook.Name line. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
String-in-Cell .... too long??? Word Wrap not working...PLEASE HE | Excel Discussion (Misc queries) | |||
Text string extraction | Excel Worksheet Functions | |||
DCOUNT function not working properly on string comparisons | Excel Worksheet Functions | |||
String Extraction... | Excel Worksheet Functions | |||
data extraction / cleansing a string column in a workbook | Excel Programming |