Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
If then to hide a combo box
I am trying to make a combo box appear if a value is greater than 1 or hide
if it is not. Below is what I have, but it does not work. Suggestions? Private Sub test_change() If Range("AJ19").Value 1 Then UserForm1.ComboBox1.Visible = True Else UserForm1.ComboBox1.Visible = False End If End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
If then to hide a combo box
I got the code to work. I only added a workseet reference.
Sub test_form() If Worksheets("main").Range("AJ19").Value 1 Then UserForm1.ComboBox1.Visible = True Else UserForm1.ComboBox1.Visible = False End If UserForm1.Show End Sub "TDC" wrote: I am trying to make a combo box appear if a value is greater than 1 or hide if it is not. Below is what I have, but it does not work. Suggestions? Private Sub test_change() If Range("AJ19").Value 1 Then UserForm1.ComboBox1.Visible = True Else UserForm1.ComboBox1.Visible = False End If End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
If then to hide a combo box
Joel,
Thanks for the help, but I still not able to make it work. I even tried a blank workbook and worksheet, but no change. Any idea what I am missing? "Joel" wrote: I got the code to work. I only added a workseet reference. Sub test_form() If Worksheets("main").Range("AJ19").Value 1 Then UserForm1.ComboBox1.Visible = True Else UserForm1.ComboBox1.Visible = False End If UserForm1.Show End Sub "TDC" wrote: I am trying to make a combo box appear if a value is greater than 1 or hide if it is not. Below is what I have, but it does not work. Suggestions? Private Sub test_change() If Range("AJ19").Value 1 Then UserForm1.ComboBox1.Visible = True Else UserForm1.ComboBox1.Visible = False End If End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
If then to hide a combo box
Do you know how to put break points into the code in VBA. there are two
possible reasons for problems 1) The code isn't being called. Put breakpoint in VBA code by putting cursor on the line and pressing F9. the usual reason for this is the code was put on the wrong module. there are different modules that are associated with different worksheets in excel. Go to excel and right click the worksheet tabe on the bottom of the worksheet. select view code. Put the code on this worksheet 2) the form or combobox has a different number than the one you are calling. right click the form and combox and select properties. The first line is the alphabetize property box is a name. This is the name you should use when call the form or combobox. I usually change these names to things like Plantscombox, TreeCombobox or whatever type data you are putting into these boxes. Otherwise, if you have multiple boxes or forms you end up referencing the wrong items. Usually problems occur when you delete items excel skips these numbers. You probably have combobox2 instead of combobox1. "TDC" wrote: Joel, Thanks for the help, but I still not able to make it work. I even tried a blank workbook and worksheet, but no change. Any idea what I am missing? "Joel" wrote: I got the code to work. I only added a workseet reference. Sub test_form() If Worksheets("main").Range("AJ19").Value 1 Then UserForm1.ComboBox1.Visible = True Else UserForm1.ComboBox1.Visible = False End If UserForm1.Show End Sub "TDC" wrote: I am trying to make a combo box appear if a value is greater than 1 or hide if it is not. Below is what I have, but it does not work. Suggestions? Private Sub test_change() If Range("AJ19").Value 1 Then UserForm1.ComboBox1.Visible = True Else UserForm1.ComboBox1.Visible = False End If End Sub |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
If then to hide a combo box
Joel,
I appreciate your efforts, but I still missing something. You you be willing to make up an example and email it to me or could I email my sample to you and you look at it to see what I have going wrong? My email address is coop458 @aol.com Thanks Terry "Joel" wrote: Do you know how to put break points into the code in VBA. there are two possible reasons for problems 1) The code isn't being called. Put breakpoint in VBA code by putting cursor on the line and pressing F9. the usual reason for this is the code was put on the wrong module. there are different modules that are associated with different worksheets in excel. Go to excel and right click the worksheet tabe on the bottom of the worksheet. select view code. Put the code on this worksheet 2) the form or combobox has a different number than the one you are calling. right click the form and combox and select properties. The first line is the alphabetize property box is a name. This is the name you should use when call the form or combobox. I usually change these names to things like Plantscombox, TreeCombobox or whatever type data you are putting into these boxes. Otherwise, if you have multiple boxes or forms you end up referencing the wrong items. Usually problems occur when you delete items excel skips these numbers. You probably have combobox2 instead of combobox1. "TDC" wrote: Joel, Thanks for the help, but I still not able to make it work. I even tried a blank workbook and worksheet, but no change. Any idea what I am missing? "Joel" wrote: I got the code to work. I only added a workseet reference. Sub test_form() If Worksheets("main").Range("AJ19").Value 1 Then UserForm1.ComboBox1.Visible = True Else UserForm1.ComboBox1.Visible = False End If UserForm1.Show End Sub "TDC" wrote: I am trying to make a combo box appear if a value is greater than 1 or hide if it is not. Below is what I have, but it does not work. Suggestions? Private Sub test_change() If Range("AJ19").Value 1 Then UserForm1.ComboBox1.Visible = True Else UserForm1.ComboBox1.Visible = False End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
hide combo box | Excel Discussion (Misc queries) | |||
Hide Combo Box | Excel Programming | |||
Hide Combo Boxes | Excel Worksheet Functions | |||
Hide my combo boxes! | Excel Discussion (Misc queries) | |||
Combo Box - Hide Combo Box w/Check Box | Excel Programming |