Results 1 to 3 of 3

creating checkbox with multiple values

Threaded View

mosslovell creating checkbox with... 10-05-2014, 11:09 AM
alansidman Re: creating checkbox with... 10-05-2014, 11:16 AM
mosslovell Re: creating checkbox with... 10-05-2014, 11:29 AM
  1. #1
    Registered User
    Join Date
    08-24-2014
    Location
    Wolverhampton, England
    MS-Off Ver
    2010
    Posts
    5

    creating checkbox with multiple values

    I have found this code online which works fine for me,, BUT...

    I want to be able to add to it so that if a user choses a different column For example E then a different drop down list will appear,

    I still want the column b to work as is.

    I have set up a new named range.

    Here is the code that works that I found from another forum site.

    Option Explicit
    Dim fillRng As Range
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
    Dim LBColors As MSForms.ListBox
    Dim LBobj As OLEObject
    Dim i As Long
    
    Set LBobj = Me.OLEObjects("LB_Colors")
    Set LBColors = LBobj.Object
    
        If Not Intersect(Target, [B2]) Is Nothing Then
            Set fillRng = Target
            With LBobj
                .Left = fillRng.Left
                .Top = fillRng.Top
                .Width = fillRng.Width
                .Visible = True
            End With
        Else
            LBobj.Visible = False
            If Not fillRng Is Nothing Then
                fillRng.ClearContents
                With LBColors
                    If .ListCount <> 0 Then
                        For i = 0 To .ListCount - 1
                            If fillRng.Value = "" Then
                                If .Selected(i) Then fillRng.Value = .List(i)
                            Else
                                If .Selected(i) Then fillRng.Value = _
                                    fillRng.Value & "," & .List(i)
                            End If
                        Next
                    End If
                    For i = 0 To .ListCount - 1
                        .Selected(i) = False
                    Next
                End With
                Set fillRng = Nothing
            End If
        End If
    
    End Sub
    thanking you in advance

    Moss
    Last edited by alansidman; 10-05-2014 at 11:15 AM. Reason: code tags added

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Sum Multiple Checkbox Values in Single Cell
    By janicesm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-01-2014, 01:30 PM
  2. [SOLVED] Creating List of Values that Appear in Multiple Columns
    By sskgintl in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-23-2013, 10:19 AM
  3. [SOLVED] Help on creating particular checkbox
    By i82 in forum Excel Charting & Pivots
    Replies: 20
    Last Post: 05-13-2013, 08:18 AM
  4. Creating CheckBox to add/not add textboxes
    By rkclutch81 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-21-2012, 04:06 AM
  5. How to display values in multiple lines if multiple checkbox's are selected?
    By kjshep in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2012, 10:10 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