+ Reply to Thread
Results 1 to 4 of 4

Case reference to Range or Table

  1. #1
    Registered User
    Join Date
    05-22-2020
    Location
    Florida, USA
    MS-Off Ver
    2016
    Posts
    2

    Case reference to Range or Table

    I would like to create the portion after the case below as a variable or better yet make it refer to the databodyrange of a table column.

    select case name

    case "Bob", "Fred", "Jimmy"
    do something
    else
    do something else
    end select

    Can the {"Bob", "Fred", "Jimmy"} after the case somehow be a reference to a table list column.

    I have a sheet in my workbook that contains lists of people the owner of the spreadsheet supervises. I want to select his people out for the do something and eliminate the people who are not his (do something else). I want the owner of the spreadsheet to be able to easily (without going into the code), add and delete members of his team.

    So he has a table (named etc.) that he can just add people to and take them away and the case uses his current list.

    Name Code
    Bob BT011
    Fred FZ012
    Jimmy JT102

    case (appears in "NAME")
    do something...

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Case reference to Range or Table

    Maybe something like this....

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    05-22-2020
    Location
    Florida, USA
    MS-Off Ver
    2016
    Posts
    2

    Re: Case reference to Range or Table

    I am trying to avoid the range reference. There are multiple ltablesbon this one sheet that I have successfully used for a variety of different automations. However he needs the flexibility to move the tables around and adjust the size.

    However I tried an if not is error similar to that and it failed me. Didn’t think about the isnumeric. Will try that with my named reference.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Case reference to Range or Table

    Here is a guide to referencing parts of a table aka ListObjects

    https://www.thespreadsheetguru.com/b...t-excel-tables


    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel Formula for lookup in Range in Reference Table
    By vamavani in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-29-2019, 09:16 AM
  2. [SOLVED] Named range and reference to one cell within dynamic table
    By jaryszek in forum Excel General
    Replies: 9
    Last Post: 03-22-2018, 07:04 AM
  3. [SOLVED] Searching for unknown text string in a range and then matching it to a reference table
    By the_nibs in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 06-10-2015, 07:26 AM
  4. Pivot table to reference a dynamic range on another sheet
    By Chumpalot in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 10-30-2014, 09:19 AM
  5. Replies: 2
    Last Post: 08-27-2014, 03:13 PM
  6. using a dynamic reference cell to copy a range of cells within a data table
    By mcash in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-11-2010, 10:22 AM
  7. [SOLVED] [SOLVED] External table/range reference trouble
    By DoctorG in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-20-2005, 08:05 AM

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