Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Mar 2006
    Location
    Princeton, New Jersey, USA
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA and Right( ) functino (Excel 2000 and 2003)

    Hi , I'm stuck ...

    Say, I have text in Cell B1. And, I need to check if the last character is an "F".
    I can do this easily in a cell on a sheet/tab by using:
    =IF(RIGHT(B1,1)="F","Do True Stuff","Do False Stuff")

    However, I need to do this in VBA code ...and I don't know how.

    So, any help would be really appreciated.

    Nite,
    --cat

  2. #2
    3 Star Lounger
    Join Date
    Feb 2003
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA and Right( ) functino (Excel 2000 and 2003)

    It's pretty much the same:

    <pre>Sub TestForF()

    If Right(Range("B1"), 1) = "F" Then
    MsgBox "true"
    Else
    MsgBox "False"
    End If
    End Sub</pre>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •