View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John Bundy John Bundy is offline
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.