Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
TDC TDC is offline
external usenet poster
 
Posts: 14
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
TDC TDC is offline
external usenet poster
 
Posts: 14
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
TDC TDC is offline
external usenet poster
 
Posts: 14
Default 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
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 Box Troubled User Excel Programming 4 October 31st 06 01:08 PM
Hide Combo Boxes AJ Excel Worksheet Functions 0 October 11th 06 04:22 AM
Hide my combo boxes! hays4 Excel Discussion (Misc queries) 6 November 7th 05 02:45 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 12:17 AM.

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

About Us

"It's about Microsoft Excel"