Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default 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
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
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 LunaMoon Excel Discussion (Misc queries) 9 July 29th 08 12:28 AM
Search for 2 true arguments and return true or false David Excel Discussion (Misc queries) 3 July 15th 06 10:18 AM
Shapes.visible = false/true Ctech[_122_] Excel Programming 2 March 22nd 06 02:25 PM
Function to return True/False if all are validated as True by ISNU Tetsuya Oguma Excel Worksheet Functions 2 March 15th 06 10:28 AM
True Or False, no matter what... it still displays the false statement rocky640[_2_] Excel Programming 2 May 13th 04 04:57 PM


All times are GMT +1. The time now is 10:58 PM.

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"