List boxes+tick boxes problem

afranks1987

New Member
Joined
Jun 11, 2009
Messages
2
Hi all,

I'm looking to create a system where a user selects a tick box and three cells on the same row as the tick box are copied to a list box (or suitable alternative) which is on a separate sheet.

When the tick box is deselected, the entry should be removed from the list box.

Is this possible?

Thanks a lot,

Adam
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hello,
Welcome to the board:) You will want to add an activex checkbox and listbox to a worksheet. (XL2003 View>ToolBars>Control ToolBox;XL2007 Developer>Controls>Insert) Then put this code in the worksheet module:
Code:
Private Sub CheckBox1_Change()
    Dim cll As Excel.Range
    Dim lngIndx As Long
    If Me.CheckBox1.Value Then
        For Each cll In Me.Range("B5:D5").Cells
            Me.ListBox1.AddItem cll.Value
        Next
    Else
        For Each cll In Me.Range("B5:D5").Cells
            For lngIndx = 0 To Me.ListBox1.ListCount - 1
                If Me.ListBox1.List(lngIndx) = CStr(cll.Value) Then
                    Me.ListBox1.RemoveItem lngIndx
                    Exit For
                End If
            Next
        Next
    End If
End Sub
 
Upvote 0
Thank you very much Oorang. That all seems to make sense. I'll let you know when I've got it working.

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,215,754
Messages
6,126,680
Members
449,328
Latest member
easperhe29

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top