Here is the part of my code in the UserForm object which faults if the UserForm is closed without entering any data:
- Private Sub GST_Incl_txb_Exit(ByVal Cancel As MSForms.ReturnBoolean)
- GST_Incl_txb.Text = Format$(GST_Incl_txb.Text, "#,##0.00")
- GST_Excl_txb.Value = (GST_Incl_txb / 1.1)
- GST_Excl_txb.Text = Format$(GST_Excl_txb.Text, "#,##0.00")
- GST_txb.Value = (GST_Incl_txb / 11)
- GST_txb.Text = Format$(GST_txb.Text, "#,##0.00")
- End Sub
The second line is causing it, as there is an error dividing nothing by 1.1 - and I do understand why.
There needs to be some kind of error trapping where the line (and the line two lines down, too) is ignored if there is nothing in the GST_Incl_txb textbox, but nothing I've tried seems to work.
Does anyone have any ideas?