![]() |
Hide combo 3 based on combo1
Hi guys, Two specific combo boxes, cmbhardwarecat and cmbprintercat. If cmbhardwarecat = printer then show cmbprintercat (including lable: lblprintercat) otherwise hide. trying to work out why this isn't working: Code: -------------------- Private Sub cmbprintercat_Change() If Not cmbHardwarecat.Value = "Printer" Then cmbprintercat.Visible = False lblprintercat.Visible = False Else If cmbHardwarecat.Value = "Printer" Then cmbprintercat.Visible = True lblprintercat.Visible = True End If End If End Sub -------------------- Any ideas would be much apprciated. -- harpscardiff ------------------------------------------------------------------------ harpscardiff's Profile: http://www.excelforum.com/member.php...o&userid=25960 View this thread: http://www.excelforum.com/showthread...hreadid=541063 |
Hide combo 3 based on combo1
Hi,
try to set breakpoint at the first If and when the code stops after changing "cmbprintercat", check the value of cmbHardwarecat in immediate window. Maybe it is "printer" or "PRINTER" (which doesn't match with "Printer"). You may use UCASE to convert both values to the same case. Also maybe that boundcolumn for cmbHardwarecat contains different value then "printer", then set appropriate column to be boundcolumn. Regards, Ivan |
Hide combo 3 based on combo1
Thanks for the replys, Ivan, Check values again, set them to lowercase. Ardus, couldn't get your method to work. Do I need to set cmbprintercat Visible = False via the properites -- harpscardif ----------------------------------------------------------------------- harpscardiff's Profile: http://www.excelforum.com/member.php...fo&userid=2596 View this thread: http://www.excelforum.com/showthread.php?threadid=54106 |
Hide combo 3 based on combo1
Hi,
this should work: Private Sub cmbprintercat_Change() dim bolHardwarecatVisible as boolean bolHardwarecatVisible = ucase(cmbHardwarecat.Value) = ucase("Printer") cmbprintercat.Visible = bolHardwarecatVisible lblprintercat.Visible = bolHardwarecatVisible End Sub Basically the same code as Ardus gave you. If you want cmbprintercat to be invisible when you show the userform, you can set it in properties of the control or programmaticaly before you show the userform to the user. with userform1 ..cmbprintercat.visible=false ..show end with Regards, Ivan |
Hide combo 3 based on combo1
Thanks again, but still not luck. Just to make certain cmbprintercat is manually set to visible = false Hardwarecat to visible. Once Printer is selected from the dropdown list, cmbprintercat should become visible, which more options. So the code below should be attached to the invisible combo - cmbprintercat? Code: -------------------- Private Sub cmbprintercat_Change() dim bolHardwarecatVisible as boolean bolHardwarecatVisible = ucase(cmbHardwarecat.Value) = ucase("Printer") cmbprintercat.Visible = bolHardwarecatVisible lblprintercat.Visible = bolHardwarecatVisible End Sub -------------------- -- harpscardiff ------------------------------------------------------------------------ harpscardiff's Profile: http://www.excelforum.com/member.php...o&userid=25960 View this thread: http://www.excelforum.com/showthread...hreadid=541063 |
Hide combo 3 based on combo1
I've cracked it - simple mistake!! Used: Code: -------------------- Private Sub cmbprintercat_Change() dim bolHardwarecatVisible as boolean bolHardwarecatVisible = ucase(cmbHardwarecat.Value) = ucase("Printer") cmbprintercat.Visible = bolHardwarecatVisible lblprintercat.Visible = bolHardwarecatVisible End Sub -------------------- But applied it to the cmbHardwarecat - so: Code: -------------------- Private Sub cmbHardwarecat_Change() dim bolHardwarecatVisible as boolean bolHardwarecatVisible = ucase(cmbHardwarecat.Value) = ucase("Printer") cmbprintercat.Visible = bolHardwarecatVisible lblprintercat.Visible = bolHardwarecatVisible End Sub -------------------- cheers guys!! -- harpscardiff ------------------------------------------------------------------------ harpscardiff's Profile: http://www.excelforum.com/member.php...o&userid=25960 View this thread: http://www.excelforum.com/showthread...hreadid=541063 |
Hide combo 3 based on combo1
I've cracked it - simple mistake!! Used: Code: -------------------- Private Sub cmbprintercat_Change() dim bolHardwarecatVisible as boolean bolHardwarecatVisible = ucase(cmbHardwarecat.Value) = ucase("Printer") cmbprintercat.Visible = bolHardwarecatVisible lblprintercat.Visible = bolHardwarecatVisible End Sub -------------------- But applied it to the cmbHardwarecat - so: Code: -------------------- Private Sub cmbHardwarecat_Change() dim bolHardwarecatVisible as boolean bolHardwarecatVisible = ucase(cmbHardwarecat.Value) = ucase("Printer") cmbprintercat.Visible = bolHardwarecatVisible lblprintercat.Visible = bolHardwarecatVisible End Sub -------------------- cheers guys!! -- harpscardiff ------------------------------------------------------------------------ harpscardiff's Profile: http://www.excelforum.com/member.php...o&userid=25960 View this thread: http://www.excelforum.com/showthread...hreadid=541063 |
All times are GMT +1. The time now is 06:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com