Results 1 to 10 of 10

ContentControl Listbox - Get selected "Value" instead of "Display Text"

Threaded View

kev_ ContentControl Listbox - Get... 01-26-2017, 11:58 AM
macropod Re: ContentControl Listbox -... 01-26-2017, 06:34 PM
JBeaucaire Re: ContentControl Listbox -... 01-26-2017, 06:47 PM
macropod Re: ContentControl Listbox -... 01-26-2017, 07:31 PM
JBeaucaire Re: ContentControl Listbox -... 01-26-2017, 07:58 PM
kev_ Re: ContentControl Listbox -... 01-27-2017, 11:50 AM
JBeaucaire Re: ContentControl Listbox -... 01-27-2017, 12:27 PM
JBeaucaire Re: ContentControl Listbox -... 01-27-2017, 12:27 PM
kev_ Re: ContentControl Listbox -... 01-27-2017, 01:26 PM
JBeaucaire Re: ContentControl Listbox -... 01-27-2017, 02:22 PM
  1. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: ContentControl Listbox - Get selected "Value" instead of "Display Text"

    Macropod, as per forum rules, we need to present simple ideas right here in the thread rather than links to other threads where the answer is buried somewhere. Links to other places, when used, need to be to the exact location of the exact answer for the question being posed. And the simple answer should still be posted here in the original thread 99% of the time, even with an external link for additional reading.

    Thanks for clarifying, I would never have figured that out! So the short answer is: "There's no way to read the value from the current selection, only from the original DropDownListEntries. As such, you must loop through them all until you find the one currently selected."

    This worked for me:
    Sub SelectedValues()
    Dim cc As ContentControl, i As Long
    
        For Each cc In Me.ContentControls
            For i = 1 To cc.DropdownListEntries.Count
                If cc.DropdownListEntries(i).Text = cc.Range.Text Then
                    Debug.Print cc.DropdownListEntries(i).Value
                End If
            Next i
        Next cc
    End Sub
    Last edited by JBeaucaire; 01-26-2017 at 08:00 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 02-05-2019, 12:03 AM
  2. Display "TEXT" in "Values" field in PIVOT TABLE using VBA!!
    By meus in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-05-2015, 09:56 AM
  3. Display "TEXT" in "Values" field in PIVOT TABLE using VBA!!
    By meus in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 02-04-2015, 06:14 AM
  4. Replies: 1
    Last Post: 08-15-2014, 06:00 AM
  5. Replies: 0
    Last Post: 03-21-2014, 09:58 AM
  6. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  7. How can i copy value from "HTMLText"(EMBED("Forms.HTML:Text","")),using Macro
    By andrewyang in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2010, 12:47 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