+ Reply to Thread
Results 1 to 4 of 4

If Statment

  1. #1
    Registered User
    Join Date
    11-10-2009
    Location
    Sunnyvale, Ca
    MS-Off Ver
    Excel 2003
    Posts
    7

    If Statment

    Hi,

    I would like to know how to write if statements that includes "wildcards" for spaces. For example:

    Please Login or Register  to view this content.
    my problem is that if rs!Revision = "L" and Me.txtRev = "L " then the program would think that those two are not alike because of the space after the "L " in Me.txtRev and therefore it goes though the loop when I don't want it to.

    Is there a way to have it something like this (I tried the code below and i know it doesn't work):

    Please Login or Register  to view this content.
    There is something wrong with this part of the code: " * & me.txtRev & * " and I don't know how to fix it.

    Please help.

    Thanks!
    Last edited by tnguyen; 12-02-2009 at 05:12 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: If Statment

    Check out "Like" in VBA help

  3. #3
    Registered User
    Join Date
    03-20-2008
    Location
    Buffalo, NY USA
    Posts
    43

    Re: If Statment

    You're close with the wild cards - it's your quotes that are throwing it off. And the use of the Like operator is correct too.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-10-2009
    Location
    Sunnyvale, Ca
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: If Statment

    Thanks! That works.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1