+ Reply to Thread
Results 1 to 4 of 4

Select case to check string array

  1. #1
    Registered User
    Join Date
    04-14-2010
    Location
    NZ
    MS-Off Ver
    2007,2010
    Posts
    86

    Select case to check string array

    In the attached workbook, upon clicking the button, a userform will appear, in which the user is to select what types of reads they want to keep - these get put into the listbox, and then into an array of strings (upon clicking Accept).

    I then want to have the macro loop through each cell in column C and check the value against the codes stored in the array - this is where i have the select case.

    Is there a way of having this case work without having to list each separate element of the array - sel(0), sel(1), sel(2), etc.
    Attached Files Attached Files
    Last edited by Deamo; 06-17-2010 at 01:27 AM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Select case to check string array

    You would probably have to loop through the elements of the array. Or you could look in to AutoFilter perhaps.

  3. #3
    Forum Contributor
    Join Date
    04-16-2009
    Location
    Dorset, UK
    MS-Off Ver
    Office 2003, Office 2007
    Posts
    131

    Re: Select case to check string array

    This goes inside your "For Each aCell In rngA" loop in place of your "Select Case".
    I've set Ctr as a Byte assuming that Sel won't have more than 255 elements. If it does you'll haev to change Ctr to an Integer.
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-14-2010
    Location
    NZ
    MS-Off Ver
    2007,2010
    Posts
    86

    Re: Select case to check string array

    given the number of options and further code to run, autofilter was no good.
    Thanks for that Kafrin. i'd completely fogotten upper and lower bound.

+ 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