Type mismatch help

TheWennerWoman

Active Member
Joined
Aug 1, 2019
Messages
303
Office Version
  1. 365
Platform
  1. Windows
I have this
VBA Code:
xTax = Sheet4.Range("K" & x).Value ' claim tax

xTax is dimmed as Double as it is monetary (i.e $2.33 etc).

In the source, column K is a formula that will either show a monetary value (i.e $2.33) or "".

My VBA is falling over with type mismatch when it encounters the "". How can I get around it?

I've tried all sorts - I was sure
VBA Code:
If Len(xTax) = 0 Then
    xTax = 0
End If
would do the job but it doesn't.

Any pointers appreciated.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
What do you want it to do when it sees the "" ?
If you are happy to treat it as zero this will work:
VBA Code:
    xTax = Val(Sheet4.Range("K" & x).Value) ' claim tax
 
Upvote 1
Solution

Forum statistics

Threads
1,223,903
Messages
6,175,279
Members
452,630
Latest member
OdubiYouth

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