PDA

View Full Version : Solved: Parsing?RegEx? Finding 1st character after 2nd Dash "-"



itipu
02-11-2008, 04:55 AM
I have Column "A" where data is like this:

mik-n-t12121
bob-n-s12121
don-n-d12121

Around 5000 lines....

I want something like this:


Dim c as Range
sizera = ActiveSheet.UsedRange.Rows.Count
For Each c In ActiveSheet.Range("A2:A$" & sizera)
'IF c.Value 1ST CHARACTER AFTER 2ND DASH = t THEN ....

Next c



So far struggling with the best way of identifying 1ST CHARACTER AFTER 2ND "-" is t THEN

Thanks a lot

Mike

Bob Phillips
02-11-2008, 05:14 AM
Dim c As Range
Dim pos As Long
Dim sizera As Long
sizera = ActiveSheet.UsedRange.Rows.Count
For Each c In ActiveSheet.Range("A2:A$" & sizera)
pos = InStr(c.Value, "-")
If pos > 0 Then

pos = InStr(pos + 1, c.Value, "-")
If pos > 0 Then

If Mid(c.Value, pos + 1, 1) = "t" Then

'rset of the code
End If
End If
End If
Next c