Re: Grabbing string values from the end of a string of an unknown leng
- From: "Mark Stephens" <mark@xxxxxxxxxxxxx>
- Date: Mon, 7 Jul 2008 22:44:15 +0800
Hi Mike,
Thanks very much for that works like a dream, regards,
Mark
PS Don your code is very similar but slightly more elgant looking but
unfortunately I got an error : Runtime error 5 Invalid Procedure call or
argument
"Mike H" <MikeH@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:85FD9B76-C826-4378-98D0-B6AA2DAFF479@xxxxxxxxxxxxxxxx
Mark,
Try this
Sub sonic()
Dim MyRange As Range
Set MyRange = Range("A2:AA2")
For Each c In MyRange
If InStr(1, c, "Classification") = 1 Then
mystring = Mid(c, 15, Len(c))
'do something with MyString
End If
Next
End Sub
Mike
"Mark Stephens" wrote:
Hi,
I have 3 cells containing string values:
Classification_Asset Class
Classification_Risk Classification
Classification_Geographical Breakdown
I want to tell the code to look in each cell along a row until it finds
the
string value: Classification_
Whsn it find it i then want it to pass the rest of the string to another
variable, something like this:
Dim sFirstStringValue As String
Dim sSecondStringValue As String
sFirstStringValue = "Classification_"
sSecondStringValue = Everything thatcomesafterfiststringvalue
Help much appreciated,
Regards, Mark
.
- Follow-Ups:
- Re: Grabbing string values from the end of a string of an unknown
- From: Tom Ogilvy
- Re: Grabbing string values from the end of a string of an unknown leng
- From: Don Guillett
- Re: Grabbing string values from the end of a string of an unknown
- References:
- Prev by Date: Re: Run Every 15 mins
- Next by Date: Re: Grabbing string values from the end of a string of an unknown
- Previous by thread: Re: Grabbing string values from the end of a string of an unknown
- Next by thread: Re: Grabbing string values from the end of a string of an unknown leng
- Index(es):
Relevant Pages
|