LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default string extraction not working.

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
String-in-Cell .... too long??? Word Wrap not working...PLEASE HE Steve P[_2_] Excel Discussion (Misc queries) 3 February 19th 10 09:14 PM
Text string extraction Geoffric Excel Worksheet Functions 5 December 19th 07 07:18 PM
DCOUNT function not working properly on string comparisons MJP Excel Worksheet Functions 1 June 7th 07 10:32 AM
String Extraction... iceberg27 Excel Worksheet Functions 2 October 15th 05 04:28 AM
data extraction / cleansing a string column in a workbook Keith[_12_] Excel Programming 2 May 3rd 04 08:54 PM


All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"