Calculations in a Textbox Userform using Not Null

Hmerman

Board Regular
Joined
Oct 2, 2016
Messages
102
Hello,
Hope you are well.

I have written code that does calculations with values in textboxes depending on If they are null or not. But for some reason I get a Type mismatch error despite the Not Null If statement being true.

Example:
If textbox 6 and 1 is empty and textbox 7 and 8 is not null it should calculate textbox 8 * textbox 7 Else the Next calculation should follow, otherwise End If. But I get an error 13 despite the above If criteria being true.

My code in red gives the error despite the If criteria in blue being true: <code><code>
If txb6Leweroorhon = "" And txb1Leweha = "" And Not IsNull(txb7Flo.Value) And Not IsNull(txb8Faktor.Value) Then

</code>
<code></code>
<code></code><code>
txb6Leweroorhon = txb8Faktor * txb7Flo


Else

If txb6Leweroorhon = "" And Not IsNull(txb4Rywyd.Value) And Not IsNull(txb1Leweha.Value) Then

txb6Leweroorhon = (txb4Rywyd * 100 * txb1Leweha) / 10000

End If
End If
</code></code>

Can someone please assist or give advice on how to rectify this issue?

Regards,
Herman
 
Last edited:

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Herman

Try this.
Code:
If txb6Leweroorhon = "" And txb1Leweha = "" And txb7Flo.Value <>"" And txb8Faktor.Value<>"" Then

    txb6Leweroorhon.Value = txb8Faktor.Value * txb7Flo.Value

Else

    If txb6Leweroorhon = "" And txb4Rywyd.Value<>"" And txb1Leweha.Value<>"" Then
        txb6Leweroorhon.Value = (txb4Rywyd.Value * 100 * txb1Leweha.Value) / 10000
    End If

End If
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top