Type mismatch help

TheWennerWoman

Active Member
Joined
Aug 1, 2019
Messages
308
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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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,225,754
Messages
6,186,827
Members
453,377
Latest member
JoyousOne

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