Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Parsing a string


I'm trying to figure out a simple problem. I've looked around th
forum, but can't seem to find exactly what I'm looking for. I want t
take a hyperlink and cut off everything up until the last slash an
assign the remaining string to a variable.

I want to take this string:

Code
-------------------
http://www.something.com/xNet/MainSi...4&PgCxtDir=Dow
-------------------

...and end up with this string:

Code
-------------------
Profile.aspx?LID=12345678&RecentlyViewed=true&Item Index=14&PgCxtDir=Dow
-------------------


the closest I got was getting everything before the final slash to b
assigned to a variable. I know this is a simple problem, but
appreciate any help as I'm very new to VBA. Thanks in advance

--
neverend
-----------------------------------------------------------------------
neverends's Profile: http://www.excelforum.com/member.php...fo&userid=3504
View this thread: http://www.excelforum.com/showthread.php?threadid=54955

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Parsing a string

See help under

InStrRev - finds the last occurrence of a character in a string

--
Tim Williams
Palo Alto, CA


"neverends" wrote in message
...

I'm trying to figure out a simple problem. I've looked around the
forum, but can't seem to find exactly what I'm looking for. I want to
take a hyperlink and cut off everything up until the last slash and
assign the remaining string to a variable.

I want to take this string:

Code:
--------------------

http://www.something.com/xNet/MainSi...&PgCxtDir=Down
--------------------

..and end up with this string:

Code:
--------------------
Profile.aspx?LID=12345678&RecentlyViewed=true&Item Index=14&PgCxtDir=Down
--------------------


the closest I got was getting everything before the final slash to be
assigned to a variable. I know this is a simple problem, but I
appreciate any help as I'm very new to VBA. Thanks in advance.


--
neverends
------------------------------------------------------------------------
neverends's Profile: http://www.excelforum.com/member.php...o&userid=35045
View this thread: http://www.excelforum.com/showthread...hreadid=549550



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Parsing a string

Dim s as String, v as Variant, s1 as String
s = "http://www.something.com/xNet/MainSite/Listing/Profile/Profile.aspx?
v = split(s,"/")
s1 = v(ubound(v))
msgbox s1

should work in xl2000 and later.

--
Regards,
Tom Ogilvy


"neverends" wrote:


I'm trying to figure out a simple problem. I've looked around the
forum, but can't seem to find exactly what I'm looking for. I want to
take a hyperlink and cut off everything up until the last slash and
assign the remaining string to a variable.

I want to take this string:

Code:
--------------------
http://www.something.com/xNet/MainSi...&PgCxtDir=Down
--------------------

...and end up with this string:

Code:
--------------------
Profile.aspx?LID=12345678&RecentlyViewed=true&Item Index=14&PgCxtDir=Down
--------------------


the closest I got was getting everything before the final slash to be
assigned to a variable. I know this is a simple problem, but I
appreciate any help as I'm very new to VBA. Thanks in advance.


--
neverends
------------------------------------------------------------------------
neverends's Profile: http://www.excelforum.com/member.php...o&userid=35045
View this thread: http://www.excelforum.com/showthread...hreadid=549550


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
Parsing a string simonc Excel Programming 4 March 27th 06 08:04 AM
Need help parsing a string Daminc[_38_] Excel Programming 4 January 26th 06 11:53 AM
parsing a string Mark[_57_] Excel Programming 4 April 28th 05 04:42 PM
Parsing when deliminator is a string Rose Excel Worksheet Functions 5 December 14th 04 12:54 AM
Unicode string parsing? Please help! Douglas Gennetten[_2_] Excel Programming 1 January 16th 04 08:31 AM


All times are GMT +1. The time now is 10:03 PM.

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"