ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,983
- Office Version
- 2007
- Platform
- Windows
Code shown below in use & works well BUT i wish to slightly expand on it.
Currently this works fine,
When a Listbox selection is made the colour selected is shown only & the others are cleared
This is the part i would like to also be added,
Upon making a colour selection clear the Textbox values mentioned that are not that selected colour & to only show that colours count value.
Basically if the Value selected is RED then i only need to see the value count for RED in its Textbox & make others 0
Same applies for another the colours when selected.
Currently when used im seeing values for all colours, see SCREEN SHOT EXAMPLE
Thanks to @NoSparks for the original code supplied above.
Please advise correct code Thanks.
Currently this works fine,
When a Listbox selection is made the colour selected is shown only & the others are cleared
This is the part i would like to also be added,
Upon making a colour selection clear the Textbox values mentioned that are not that selected colour & to only show that colours count value.
Basically if the Value selected is RED then i only need to see the value count for RED in its Textbox & make others 0
Same applies for another the colours when selected.
Currently when used im seeing values for all colours, see SCREEN SHOT EXAMPLE
VBA Code:
Private Sub ListBox1_Click()
Dim i As Long
Dim colour As String
colour = ListBox1.List(ListBox1.ListIndex, 3)
For i = ListBox1.ListCount - 1 To 0 Step -1
If ListBox1.List(i, 3) <> colour Then
ListBox1.RemoveItem (i)
End If
Next i
End Sub
Thanks to @NoSparks for the original code supplied above.
Please advise correct code Thanks.