Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Greetings,
I have a CommandButton on a UserForm That is covering a label and a TextBox. If there is a number in the TextBox, I need for the CommandButton to be NOT visible, so that I can see the number. If there is no number in the TextBox I need for the CommandButton to be visible and cover the Label & TextBox. Clicking the button will put the next available number into the TextBox and at the same time make the CommandButton not visible. This is the code that I trying to use: ______________________________________________ Select Case TextBox1 Case vbNullString MsgBox "TextBox1 is Empty" & TextBox1 btnNextInvNumber.Visible = True Case Else MsgBox "TextBox1 Has A Number" & TextBox1 btnNextInvNumber.Visible = False End Select ______________________________________________ The MsgBoxes were to see if the code was actually going were it was supposed to - it is. It is just not triggering the visible property Is there something wrong with my code? Is there some setting that would cause this not work? And if there is, where do I look for it? Any help would be appreciated. -Minitman |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What event did you put that code in? Your code works for me if placed in the
CommandButton's Click event. -- Rick (MVP - Excel) "Minitman" wrote in message ... Greetings, I have a CommandButton on a UserForm That is covering a label and a TextBox. If there is a number in the TextBox, I need for the CommandButton to be NOT visible, so that I can see the number. If there is no number in the TextBox I need for the CommandButton to be visible and cover the Label & TextBox. Clicking the button will put the next available number into the TextBox and at the same time make the CommandButton not visible. This is the code that I trying to use: ______________________________________________ Select Case TextBox1 Case vbNullString MsgBox "TextBox1 is Empty" & TextBox1 btnNextInvNumber.Visible = True Case Else MsgBox "TextBox1 Has A Number" & TextBox1 btnNextInvNumber.Visible = False End Select ______________________________________________ The MsgBoxes were to see if the code was actually going were it was supposed to - it is. It is just not triggering the visible property Is there something wrong with my code? Is there some setting that would cause this not work? And if there is, where do I look for it? Any help would be appreciated. -Minitman |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey Rick,
Thanks for the reply. This code can't be called from the CommandButton's click event in question because the CommandButton is supposed to be not visible when there is something in TextBox2. And when TextBox2 is empty, it needs a number (which is what the CommandButton creates when it is clicked) and then, because TextBox2 is now no longer empty, become not visible again. Does this make any sense to you? The code snippet I posted earlier is in this public sub: __________________________________________________ __________________ Public Sub ComboBox1Refresh() Dim i As Integer For i = 1 To 105 Select Case i Case 2 TextBox2 = ComboBox1.List(ComboBox1.ListIndex, 1) Select Case TextBox2.Value Case vbNullString MsgBox "TextBox2 is Empty" & TextBox2 btnNextInvNumber.Visible = True Case Else MsgBox "TextBox2 Has A Number" & TextBox2 btnNextInvNumber.Visible = False End Select Case Else Me.Controls("TextBox" & i) = _ ComboBox1.List(ComboBox1.ListIndex, i - 1) End Select Next i End Sub __________________________________________________ __________________ This sub is called from many events including the ComboBox1 change event, the format all TextBoxes sub and a few other subs. Your reply got me thinking about the logic in my web of subs calling subs. I think I'll take the time and map out these inter connections. If you can think of any other items I should be looking at, please let me know. Any help will be appreciated -Minitman On Thu, 4 Sep 2008 02:27:38 -0400, "Rick Rothstein" wrote: What event did you put that code in? Your code works for me if placed in the CommandButton's Click event. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Does your ComboBox have more than one column in it? If so, do some of the
entries in the second column have values while others don't? -- Rick (MVP - Excel) "Minitman" wrote in message ... Hey Rick, Thanks for the reply. This code can't be called from the CommandButton's click event in question because the CommandButton is supposed to be not visible when there is something in TextBox2. And when TextBox2 is empty, it needs a number (which is what the CommandButton creates when it is clicked) and then, because TextBox2 is now no longer empty, become not visible again. Does this make any sense to you? The code snippet I posted earlier is in this public sub: __________________________________________________ __________________ Public Sub ComboBox1Refresh() Dim i As Integer For i = 1 To 105 Select Case i Case 2 TextBox2 = ComboBox1.List(ComboBox1.ListIndex, 1) Select Case TextBox2.Value Case vbNullString MsgBox "TextBox2 is Empty" & TextBox2 btnNextInvNumber.Visible = True Case Else MsgBox "TextBox2 Has A Number" & TextBox2 btnNextInvNumber.Visible = False End Select Case Else Me.Controls("TextBox" & i) = _ ComboBox1.List(ComboBox1.ListIndex, i - 1) End Select Next i End Sub __________________________________________________ __________________ This sub is called from many events including the ComboBox1 change event, the format all TextBoxes sub and a few other subs. Your reply got me thinking about the logic in my web of subs calling subs. I think I'll take the time and map out these inter connections. If you can think of any other items I should be looking at, please let me know. Any help will be appreciated -Minitman On Thu, 4 Sep 2008 02:27:38 -0400, "Rick Rothstein" wrote: What event did you put that code in? Your code works for me if placed in the CommandButton's Click event. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey Rick,
Yes. I has 105 columns in it. Yes. There are 27 rows in this ComboBox, The 27 rows have never all used in the last 10 years. 27 is a legacy figure from when we had more customers per day. These days we might have 8 customers but usually we have around 4 per day. Column 2 is the invoice number. This number is assigned on the UserForm by clicking on the CommandButton. I am trying to make the button only visible when it is needed - when there is no invoice number in TextBox2. The timing on the ComboBox is set so that the first empty row in column 3 comes up, then the code disables the up button. I still have to figure out how to disable any other way of advancing to the second to 27 empty row. If your willing, I could send you a copy of the workbooks, MCL6.xls (trimmed down as a sample - needed as a source for the scheduler) and the scheduler - 2008-08.xls. (yes, I am still in Office 2003) From your question, it sounds like you may have an idea. I look forward to hearing from you. -Minitman On Thu, 4 Sep 2008 11:40:42 -0400, "Rick Rothstein" wrote: Does your ComboBox have more than one column in it? If so, do some of the entries in the second column have values while others don't? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Set Visible Cells To TRUE | Excel Programming | |||
how to set pivotitem.visible property to true | Excel Programming | |||
TextBox.Visible = True ... not working | Excel Programming | |||
ActiveWindow.Visible = True | Excel Programming | |||
how to set pivotitem.visible property to true | Excel Programming |