Re: Substring in excel? How about regular expressions?

Giganews Newsgroups
Subject: Re: Substring in excel? How about regular expressions?
Posted by:  Norman Jones (normanjon…@whereforartthou.com)
Date: Mon, 22 May 2006

Hi Samuel,

Try:

    Dim sStr As String

    sStr = ActiveSheet.Cells(r, c).Value

    If Left(sStr, 3) = "USA" Then
            'Do something
    End If

---
Regards,
Norman

"Samuel" <stwils…@writeme.com> wrote in message
news:1148308719.403980.1533…@g10g2000cwb.googlegroups.com...
>I need to act upon the test "USA" found in the first three chars of a
> cell.
> This is what I did, but I get a compile error..
> So I did something wrong. How do I copare against specifc characters?
> Even better, can I use regular expressions?
>
>  str = ActiveSheet.Cells(r, c)
>  check = substr(str, 1, 3)
>  If (check = "USA") Then
>      ' do something
>  End If

Replies

None

In response to

Substring in excel? How about regular expressions? posted by Samuel on 22 May 2006