+ Reply to Thread
Results 1 to 3 of 3

Obtaining the Index Number of a Drop-Down List

Hybrid 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
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Obtaining the Index Number of a Drop-Down List

    Example
    Sub test()
        Dim rng As Range, r As Range, s As String, x, temp, msg As String
        On Error Resume Next
        Set rng = Cells.SpecialCells(xlCellTypeAllValidation)
        On Error GoTo 0
        If rng Is Nothing Then MsgBox "No cell has Validation": Exit Sub
        For Each r In rng
            If r.Validation.Type = 3 Then
                s = r.Validation.Formula1
                If s Like "=*" Then
                    x = Evaluate(Mid(s, 2) & "&""""")
                Else
                    x = Split(s, ",")
                End If
                temp = Application.Match(CStr(r), x, 0)
                If Not IsError(temp) Then msg = msg & vbLf & r.Address(0, 0) & vbTab & temp
            End If
        Next
        If Len(msg) Then MsgBox "Cell" & vbTab & "Index" & msg
    End Sub

  2. #2
    Registered User
    Join Date
    01-18-2022
    Location
    Malaysia
    MS-Off Ver
    Office 2019, Office 2021, Office 365
    Posts
    2

    Re: Obtaining the Index Number of a Drop-Down List

    Thank you very much for your example jindon. As I'm still not too familiar with all the various objects you've included in your code, I'll need to do some research to understand your example. I'll get back to you should I have any further questions.

    In the meanwhile, I am still open for other solutions that may solve my issue. I've also edited the original post to include some further context and welcome any other means of carrying it out.

+ 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. 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