+ Reply to Thread
Results 1 to 4 of 4

Does VBA have an OR ( ) like Excel does?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-15-2009
    Location
    Herndon, VA
    MS-Off Ver
    Excel 2010
    Posts
    163

    Does VBA have an OR ( ) like Excel does?

    I know about the OR operator, but does VBA have an OR function that can take in multiple arguments such as OR(x,y,z)?

    I can't find one. I have a loop which will loop through columns 1 thru 20. But I want to skip over some columns. So upon entering the loop, there would be an IF statement testing which column number the macro is currently on.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Does VBA have an OR ( ) like Excel does?

    if a or b or c then
        ...
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,962

    Re: Does VBA have an OR ( ) like Excel does?

    Maybe:
        Select Case columnNum
            Case Is = 2, 4, 8, 10
                MsgBox ColumnNum
        End Select
    Ben Van Johnson

  4. #4
    Forum Contributor
    Join Date
    12-15-2009
    Location
    Herndon, VA
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: Does VBA have an OR ( ) like Excel does?

    Quote Originally Posted by protonLeah View Post
    Maybe:
        Select Case columnNum
            Case Is = 2, 4, 8, 10
                MsgBox ColumnNum
        End Select
    Very nice. Very simple too. Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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