I am creating a vba form which I have 2 textbox and 1 combobox as attached. I would like to create the following condition. When the user try to change the combobox value without having put the amount in the 2 textbox first I would like to display a message e.g. "The textboxes need to have values", not allowing the user to continue. Could you please help me?
VBA Code:
Sub TextBoxnull()
If Len(TextBoxnull.txtTOPDtotalrem.Value) = 0 And Len(TextBoxnull.txtTOPDmedical.Value) > 0 Then
MsgBox "Number must be entered to continue!"
End If
TextBoxnull.cboTOPDsuperannuationperc.Value = Format(TextBoxnull.cboTOPDsuperannuationperc.Value, "0%")
Sheet1.Range("B10").Value = Format(TextBoxnull.cboTOPDsuperannuationperc.Value, "0%")
With TextBoxnull
.txtTOPtaxableremexclsuperannuation.Value = Format(Sheet1.Range("B13").Value, "$#,##0.00;-$#,##0.00")
.txtTOPsuperannuationcontribution.Value = Format(Sheet1.Range("B14").Value, "$#,##0.00;-$#,##0.00")
.txtTOPDtotalremnet.Value = Format(Sheet1.Range("B15").Value, "$#,##0.00;-$#,##0.00")
End With
End Sub