+ Reply to Thread
Results 1 to 4 of 4

How to add range to Case Statement

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    09-04-2007
    Location
    Ontario, Ca
    Posts
    624

    How to add range to Case Statement

    My case statement worked until I added the range as shown at the end of the case line. I don't know how to code this. I just added the between portion for example of what I am looking for.

    Select Case ActiveCell.Column
        Case 4, 5, 6, 7, 8, 9, 10, 11, 12, between 30 and 77
    GoTo SortColumnOnly
    End Select
    Last edited by Launchnet; 10-20-2010 at 01:52 PM.
    Thanks for helping . . .
    Matt @ Launchnet

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: How to add range to Case Statement

    Hello Matt,

    "Between" is represented by "To" in the Case statement...
    Select Case ActiveCell.Column
        Case 4, 5, 6, 7, 8, 9, 10, 11, 12, 30 To 77
    GoTo SortColumnOnly
    End Select
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to add range to Case Statement

    Also given whole numbers:

    Case 4 To 12, 30 To 77

  4. #4
    Valued Forum Contributor
    Join Date
    09-04-2007
    Location
    Ontario, Ca
    Posts
    624

    Re: How to add range to Case Statement

    Thanks DonKeyOte & Leith. Really simple. Many Thanks again. I'll mark it solved.

+ 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