Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox.visible = False or True
This code shows updates the worksheet cell when ComboBox1 is changed. Then
it updates CombBox2 to reflect this new change. Private Sub ComboBox1_Change() Worksheets("sheet1").Range("C16") = Me.ComboBox1.Value CombBox2 = Worksheets("Sheet1").Range("B23").Value End Sub ....now if this ComboBox2 doesn't have a value, I want to combobox itself to be visible=Fasle. I could add another line in the above code to do this, right? I tried adding this, but it didn't work: If ComboBox2 .Value = "" Then ComboBox2 .Visible = False Else ComboBox2 .Visible = True End If ....am I close to getting it? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox.visible = False or True
Try ComboBox2.Hidden = True
"Charlie" wrote: This code shows updates the worksheet cell when ComboBox1 is changed. Then it updates CombBox2 to reflect this new change. Private Sub ComboBox1_Change() Worksheets("sheet1").Range("C16") = Me.ComboBox1.Value CombBox2 = Worksheets("Sheet1").Range("B23").Value End Sub ...now if this ComboBox2 doesn't have a value, I want to combobox itself to be visible=Fasle. I could add another line in the above code to do this, right? I tried adding this, but it didn't work: If ComboBox2 .Value = "" Then ComboBox2 .Visible = False Else ComboBox2 .Visible = True End If ...am I close to getting it? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox.visible = False or True
No, that won't work, but Me.Controls.ComboBox2.Visible = False might.
"Charlie" wrote: This code shows updates the worksheet cell when ComboBox1 is changed. Then it updates CombBox2 to reflect this new change. Private Sub ComboBox1_Change() Worksheets("sheet1").Range("C16") = Me.ComboBox1.Value CombBox2 = Worksheets("Sheet1").Range("B23").Value End Sub ...now if this ComboBox2 doesn't have a value, I want to combobox itself to be visible=Fasle. I could add another line in the above code to do this, right? I tried adding this, but it didn't work: If ComboBox2 .Value = "" Then ComboBox2 .Visible = False Else ComboBox2 .Visible = True End If ...am I close to getting it? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox.visible = False or True
I couldn't get that to work: I said combobox, but meant textbox, earlier, so
let me start over: I have ComboBox1 & TextBox1. A change is made to ComboBox1, which affects TextBox1. If TextBox1 is blank (no string), then I need the property ..visible of TextBox1 to be set to False. I think this all happens here? Private Sub ComboBox1_Change() Worksheets("sheet1").Range("C16") = Me.ComboBox1.Value TextBox1 = Worksheets("Sheet1").Range("B23").Value If TextBox1.Value = "" Then Me.Controls.TextBox1.Visible = False Else Me.Controls.Text1.Visible = True End If End Sub ....but the line Me.Controls.Text1.Visible gives me an error. It must be close to being right... |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox.visible = False or True
...but the line Me.Controls.Text1.Visible gives me an error.
You use the Controls collection when you want to refer to a control by its name. E.g., Me.Controls("TextBox1").Visible = False If you are referring directly to the control, omit the Controls reference: Me.TextBox1.Visible = False -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Charlie" wrote in message ... I couldn't get that to work: I said combobox, but meant textbox, earlier, so let me start over: I have ComboBox1 & TextBox1. A change is made to ComboBox1, which affects TextBox1. If TextBox1 is blank (no string), then I need the property .visible of TextBox1 to be set to False. I think this all happens here? Private Sub ComboBox1_Change() Worksheets("sheet1").Range("C16") = Me.ComboBox1.Value TextBox1 = Worksheets("Sheet1").Range("B23").Value If TextBox1.Value = "" Then Me.Controls.TextBox1.Visible = False Else Me.Controls.Text1.Visible = True End If End Sub ...but the line Me.Controls.Text1.Visible gives me an error. It must be close to being right... |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox.visible = False or True
I made to typing error Me.Controls.Text1
I fixed to Me.Controls.TextBox1 but it still doesn't work... |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox.visible = False or True
If TextBox1.Value = "" Then
Me.Controls.TextBox1.Visible = False Else Me.Controls.Text1.Visible = True End If TYPO Me.Controls.TextBox1.Visible = True susan On Dec 21, 11:32*am, Charlie wrote: I couldn't get that to work: *I said combobox, but meant textbox, earlier, so let me start over: I have ComboBox1 & TextBox1. *A change is made to ComboBox1, which affects TextBox1. *If TextBox1 is blank (no string), then I need the property .visible of TextBox1 to be set to False. *I think this all happens here? Private Sub ComboBox1_Change() Worksheets("sheet1").Range("C16") = Me.ComboBox1.Value TextBox1 = Worksheets("Sheet1").Range("B23").Value * *If TextBox1.Value = "" Then * * * *Me.Controls.TextBox1.Visible = False * *Else * * *Me.Controls.Text1.Visible = True * *End If End Sub ...but the line * * *Me.Controls.Text1.Visible * * * gives me an error. It must be close to being right... |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
ComboBox.visible = False or True
chip said remove the "controls"
as in Me.Textbox1.Visible=True susan On Dec 21, 11:42*am, Charlie wrote: I made to typing error *Me.Controls.Text1 I fixed to *Me.Controls.TextBox1 but it still doesn't work... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
What's the best way to toggle between true and false in Excel? Hiall, My excel work involves a lot of toggling between true and false (booleantypes) ... and it's very repetitive... Is there a way to select a bunch ofcells, and press a key short-cu | Excel Discussion (Misc queries) | |||
Search for 2 true arguments and return true or false | Excel Discussion (Misc queries) | |||
Shapes.visible = false/true | Excel Programming | |||
Function to return True/False if all are validated as True by ISNU | Excel Worksheet Functions | |||
True Or False, no matter what... it still displays the false statement | Excel Programming |