Userform Textboxes.jpg Error on Userform.jpg
I have created a exel userform that performs calculations for banking account that is working pretty well, but if the entry for entry your bank account balance is deleted and your either hit enter or tab it crashes. (See attached file for :Userform Textboxes”.
I have placed the following code in the Account Balance box that the user enters and it does work well when the user enters data in TextBox329. Textbox 328 is the Month end balance box.
Private Sub TextBox329_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox330.Value = Format$(TextBox328.Value - TextBox329.Value, "0.00")End If
EndSub
TextBox330 is the box labeled Difference. I have tried the code TextBox code In many different locations, such as change, etc. The problem I am having is that if the box is empty, or if an entry has been deleted and the user hits enter or tab, it crashes and shows the error “Run-time error ‘13’: Type mismatch and if I click on Debug it takes me to the line above and shown in the attached file “Error on Userform”.
The other text boxes are being loaded in a macro sing the follow code:
UserForm4.TextBox328.Text = Worksheets(Sheetname).Range("O4").Value
Where it is pulling data from an excel sheet where numbered values are stored. I have tried many different methods of trying to handle this error but have been unsuccessful. Any suggestions would be greatly appreciated.
Bookmarks