#1   Report Post  
Posted to microsoft.public.excel.misc
Rowan Drummond
 
Posts: n/a
Default Partial String

Try:

Dim myStr As String
Dim myNewStr As String
myStr = "67890 / 1111"
myNewStr = Right(myStr, 4)
Debug.Print myNewStr

Hope this helps
Rowan

mjack003 wrote:
Howdy,

How would I go about deleting entire strings, of variable length,
saving only the last four digits of each? Ex: myStr = 67890 / 1111 and
I want myNEWStr = 1111. I need to automate this in VBA.

Appreciate the help,

Mjack


  #2   Report Post  
Posted to microsoft.public.excel.misc
mjack003
 
Posts: n/a
Default Partial String


Howdy,

How would I go about deleting entire strings, of variable length,
saving only the last four digits of each? Ex: myStr = 67890 / 1111 and
I want myNEWStr = 1111. I need to automate this in VBA.

Appreciate the help,

Mjack


--
mjack003
------------------------------------------------------------------------
mjack003's Profile: http://www.excelforum.com/member.php...fo&userid=5141
View this thread: http://www.excelforum.com/showthread...hreadid=494043

  #3   Report Post  
Posted to microsoft.public.excel.misc
mjack003
 
Posts: n/a
Default Partial String


That works great but I don't think I was very clear. I need everything
after the "/" backslash. So is there a way to omit everything before
that character and save only the remaining part?

Thanks for the input,

Mjack


--
mjack003
------------------------------------------------------------------------
mjack003's Profile: http://www.excelforum.com/member.php...fo&userid=5141
View this thread: http://www.excelforum.com/showthread...hreadid=494043

  #4   Report Post  
Posted to microsoft.public.excel.misc
Rowan Drummond
 
Posts: n/a
Default Partial String

Try:

Dim myStr As String
Dim myNewStr As String
myStr = "67890 / 1111"
myNewStr = Mid(myStr, InStr(1, myStr, "/") + 1, Len(myStr))
Debug.Print myNewStr

If want the backslash included in the result then you would remove the
"+ 1" but you would then need to include some error handling incase your
string did not contain "/".

Regards
Rowan

mjack003 wrote:
That works great but I don't think I was very clear. I need everything
after the "/" backslash. So is there a way to omit everything before
that character and save only the remaining part?

Thanks for the input,

Mjack


Reply
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
Summing partial strings. [email protected] Excel Worksheet Functions 4 October 8th 05 11:32 AM
Looking up a string of text within a string of text tobriant Excel Worksheet Functions 4 September 20th 05 06:59 PM
Auto convert an alphanumeric string (CIS9638S) to numbers only? Gary L Brown Excel Worksheet Functions 1 September 7th 05 01:17 AM
Inserting Filtered RC cell information into other worksheets Dennis Excel Discussion (Misc queries) 10 July 30th 05 01:54 AM
How do I use 3 cells to create the string for a lookup function? Bencomo Excel Worksheet Functions 1 May 15th 05 07:17 AM


All times are GMT +1. The time now is 05:51 PM.

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

About Us

"It's about Microsoft Excel"