Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default 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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
hide combo box JD Excel Discussion (Misc queries) 6 February 17th 09 06:34 PM
Hide Combo Boxes AJ Excel Worksheet Functions 0 October 11th 06 04:22 AM
In Excel I need to set up a combo box based on another combo box. donna_ge Excel Discussion (Misc queries) 2 March 29th 06 03:26 PM
Combo box values based on other combo box value JCanyoneer Excel Programming 1 April 5th 05 06:41 PM
Combo Box - Hide Combo Box w/Check Box Paul Excel Programming 5 December 3rd 04 10:58 PM


All times are GMT +1. The time now is 02:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"