• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

If textbox 1 is not empty then fill textbox 2

Hello every body.
I have 15 comboboxes and 2 textboxes
If I choose a value in one of these comboboxes (value = Mdif) then it should fill textbox 1
but if textbox 1 is already filled it should fill textbox 2 and if the 2 textboxes are filled and someone chooses for the 3 time the value Mdif then they should get a messagebox textboxes are full
Something in this direction
Code:
Private Sub ComboBox1_Change()
If ComboBox1.Value = "Mdif" Then
TextBox1.Value = Label1.Caption
Else
If TextBox1.Value > 0 Then
If ComboBox1.Value = "Mdif" Then
TextBox2.Value = Label1.Caption
End If
End If
End If
End Sub
Thanks in advance
 
Hi ,

See if this works.
Code:
Private Sub ComboBox1_Change()
            If ComboBox1.Value = "Mdif" Then
               If TextBox1.Value = vbNullString Then
                  TextBox1.Value = Label1.Caption
               ElseIf TextBox2.Value = vbNullString Then
                  TextBox2.Value = Label1.Caption
               Else
                  MsgBox "Both textboxes are populated !", vbOKOnly
               End If
            End If
End Sub
Narayan
 
Back
Top