mykulpasskwa
Board Regular
- Joined
- Mar 20, 2018
- Messages
- 66
Hello again
I have the code below working that someone wrote for me. It works great, but when a textbox on the multipage is blank I get a Type mismatch error. I've tried writing an error check and everything, but I just keep getting errors. Does anyone know how to make it so that when the text box is blank it just adds the textboxes that do have numbers?
I have the code below working that someone wrote for me. It works great, but when a textbox on the multipage is blank I get a Type mismatch error. I've tried writing an error check and everything, but I just keep getting errors. Does anyone know how to make it so that when the text box is blank it just adds the textboxes that do have numbers?
Code:
Private Sub cbEnterFees_Click()
'Enters UserForm data onto spreadsheet
Dim ans As Long
Dim i As Long
i = 0
For Each Control In MultiPage1.Pages(i).Controls 'For each control on Multipage1
If TypeName(Control) = "TextBox" Then ans = ans + Control.Value 'the answer is the answer plus the value in the textbox
Next
ActiveCell.Offset(0, 2).Value = ans
Unload FeesForm
End Sub