Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Show Results in TextBoxes, ONLY if All TextBoxes have Data in them

I have a total of 8 Textboxes and 1 ComboBox in a UserForm. Textboxes 1-4
show calculation results that are dependent on Textboxes 5-8 and the
ComboBox. I am currently using the Change Event in Textboxes 5-8 and the
ComboBox for an instant calculation for the user to see. My question is how
do I get Textboxes 1-4 to be blank if any of the Textboxes 5-8 or the
Combobox is blank.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Show Results in TextBoxes, ONLY if All TextBoxes have Data in them

Try something like this
Function checkBoxes(w, x, y, z)
Dim tbEmpty As Boolean
tbEmpty = False
If w = "" Then tbEmpty = True
If x = "" Then tbEmpty = True
If y = "" Then tbEmpty = True
If z = "" Then tbEmpty = True
If tbEmpty = True Then checkBoxes = "True" Else checkBoxes = "False"
End Function


Private Sub CommandButton1_Click()
Dim txt1, txt2, txt3, txt4 As String
txt1 = Trim(TextBox5.Text)
txt2 = Trim(TextBox6.Text)
txt3 = Trim(TextBox7.Text)
txt4 = Trim(TextBox8.Text)

If checkBoxes(txt1, txt2, txt3, txt4) = "True" Then Exit Sub
'calculations

End Sub

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"RyanH" wrote:

I have a total of 8 Textboxes and 1 ComboBox in a UserForm. Textboxes 1-4
show calculation results that are dependent on Textboxes 5-8 and the
ComboBox. I am currently using the Change Event in Textboxes 5-8 and the
ComboBox for an instant calculation for the user to see. My question is how
do I get Textboxes 1-4 to be blank if any of the Textboxes 5-8 or the
Combobox is blank.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Show Results in TextBoxes, ONLY if All TextBoxes have Data in

I appreciate the fast response John! I'm not sure if this is what I need. I
think your example requires CheckBoxes and/or a Command Button Click Event.
I need the Values of TextBoxes 1-4 to be "" if all the TextBoxes 5-8 and the
ComboBox are blank.

"John Bundy" wrote:

Try something like this
Function checkBoxes(w, x, y, z)
Dim tbEmpty As Boolean
tbEmpty = False
If w = "" Then tbEmpty = True
If x = "" Then tbEmpty = True
If y = "" Then tbEmpty = True
If z = "" Then tbEmpty = True
If tbEmpty = True Then checkBoxes = "True" Else checkBoxes = "False"
End Function


Private Sub CommandButton1_Click()
Dim txt1, txt2, txt3, txt4 As String
txt1 = Trim(TextBox5.Text)
txt2 = Trim(TextBox6.Text)
txt3 = Trim(TextBox7.Text)
txt4 = Trim(TextBox8.Text)

If checkBoxes(txt1, txt2, txt3, txt4) = "True" Then Exit Sub
'calculations

End Sub

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"RyanH" wrote:

I have a total of 8 Textboxes and 1 ComboBox in a UserForm. Textboxes 1-4
show calculation results that are dependent on Textboxes 5-8 and the
ComboBox. I am currently using the Change Event in Textboxes 5-8 and the
ComboBox for an instant calculation for the user to see. My question is how
do I get Textboxes 1-4 to be blank if any of the Textboxes 5-8 or the
Combobox is blank.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Show Results in TextBoxes, ONLY if All TextBoxes have Data in

I just named it checkboxes, as in check the textboxes. I did forget the
combobox. This should cover you, but I did leave it as a button click event,
put the function outside of course but put the code inside the button click
event inside whatever event you are using.

Function checkBoxes(v, w, x, y, z)
Dim tbEmpty As Boolean
tbEmpty = False
If w = "" Then tbEmpty = True
If x = "" Then tbEmpty = True
If y = "" Then tbEmpty = True
If z = "" Then tbEmpty = True
If tbEmpty = True Then checkBoxes = "True" Else checkBoxes = "False"
End Function


Private Sub CommandButton1_Click()
Dim txt1, txt2, txt3, txt4, cmb1 As String
txt1 = Trim(TextBox5.Text)
txt2 = Trim(TextBox6.Text)
txt3 = Trim(TextBox7.Text)
txt4 = Trim(TextBox8.Text)
cmb1 = Trim(ComboBox1.Text)

If checkBoxes(cmb1, txt1, txt2, txt3, txt4) = "True" Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
End If

End Sub
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"RyanH" wrote:

I appreciate the fast response John! I'm not sure if this is what I need. I
think your example requires CheckBoxes and/or a Command Button Click Event.
I need the Values of TextBoxes 1-4 to be "" if all the TextBoxes 5-8 and the
ComboBox are blank.

"John Bundy" wrote:

Try something like this
Function checkBoxes(w, x, y, z)
Dim tbEmpty As Boolean
tbEmpty = False
If w = "" Then tbEmpty = True
If x = "" Then tbEmpty = True
If y = "" Then tbEmpty = True
If z = "" Then tbEmpty = True
If tbEmpty = True Then checkBoxes = "True" Else checkBoxes = "False"
End Function


Private Sub CommandButton1_Click()
Dim txt1, txt2, txt3, txt4 As String
txt1 = Trim(TextBox5.Text)
txt2 = Trim(TextBox6.Text)
txt3 = Trim(TextBox7.Text)
txt4 = Trim(TextBox8.Text)

If checkBoxes(txt1, txt2, txt3, txt4) = "True" Then Exit Sub
'calculations

End Sub

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"RyanH" wrote:

I have a total of 8 Textboxes and 1 ComboBox in a UserForm. Textboxes 1-4
show calculation results that are dependent on Textboxes 5-8 and the
ComboBox. I am currently using the Change Event in Textboxes 5-8 and the
ComboBox for an instant calculation for the user to see. My question is how
do I get Textboxes 1-4 to be blank if any of the Textboxes 5-8 or the
Combobox is blank.

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
Need help w/ userform with 12 textboxes with data going into colum cj2k2k Excel Discussion (Misc queries) 1 June 13th 07 02:38 PM
How not to show zero in textboxes? John Smith Excel Programming 1 December 16th 06 05:41 AM
Combining data in multiple textboxes toocold[_5_] Excel Programming 2 March 29th 06 10:53 PM
Transferring cell data to textboxes Merlin Excel Programming 1 October 5th 05 06:47 PM
searching for a combobox.value and filling in textboxes from results GregJG[_18_] Excel Programming 3 July 8th 04 12:41 PM


All times are GMT +1. The time now is 04:15 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"