Results 1 to 3 of 3

Obtaining the Index Number of a Drop-Down List

Threaded View

Stylin80 Obtaining the Index Number of... 01-18-2022, 11:57 PM
jindon Re: Obtaining the Index... 01-19-2022, 01:45 AM
Stylin80 Re: Obtaining the Index... 01-19-2022, 02:06 AM
  1. #1
    Registered User
    Join Date
    01-18-2022
    Location
    Malaysia
    MS-Off Ver
    Office 2019, Office 2021, Office 365
    Posts
    2

    Obtaining the Index Number of a Drop-Down List

    Hello all, I've recently just started learning for a few weeks VBA for Excel as I wanted to better utilize Excel in general. As such, I'm sorry if my questions are relatively simple and/ or have been solved through another post.

    Currently, as the title explains, I'm trying to get the index number of a drop down list that is created via conditional formatting. I am aware that there are already solutions available on the web for this simple issue of mine, but I am unable to understand their solution as I lack the knowledge in VBA to fully understand it. As such, I would greatly appreciate it if someone could either offer me a solution to my issues along with a simple explanation as to what is going on.

    Here is some detailed information regarding my troubles. Basically, as shown in the picture, I am have a sample drop down menu made with conditional formatting. My objective is to return the index value of the selected option to a variable within VBA. For instance, when the user selects "a", "1" is returned to the variable; "2" is returned when "b" is selected, etc.

    Temp.png

    Thank you very much.


    Edit 1: For some further context, I am attempting to basically get a reference to the content of the cell in which a user is able to pick from a fixed drop-down list. I figured if I was able to get the index number of the drop-down list selected, I will later then be able to use a case structure to progress further down the line depending on the user selection. The only other solution that I have managed to though of is a simple 'If-Else' nested structure. While it will work by directly comparing the string of the cell with the various possible options, it really isn't an efficient method of comparison and a very messy solution. I believe the function 'StrComp' is able to perform the same task (correct me if I'm wrong), but in this case, it would be identical to a nested 'If-Else' structure.
    Last edited by Stylin80; 01-19-2022 at 02:19 AM. Reason: Further context

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Linking drop down list index between cells.
    By Hustey in forum Excel General
    Replies: 7
    Last Post: 09-06-2016, 03:12 PM
  2. Index match using drop down list
    By tenjim in forum Excel General
    Replies: 3
    Last Post: 05-03-2016, 02:56 PM
  3. [SOLVED] Index Match & MAX with Drop list
    By Imran Magsi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-03-2016, 04:59 AM
  4. [SOLVED] Setting list index of drop down list, or clearing them ?
    By Lukael in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 07-30-2014, 01:08 PM
  5. Replies: 2
    Last Post: 08-26-2011, 09:59 AM
  6. How to get index of selected item in drop down list?
    By nleahcim in forum Excel General
    Replies: 3
    Last Post: 08-08-2011, 02:08 PM
  7. Obtaining cell reference from index function
    By MH UK in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-22-2006, 10:00 AM

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