Type mismatch error in this specific case

davquak

New Member
Joined
Jan 13, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi all,
I've been following a youtube tutorial on how to create an invoice system in excel, and by following I mean almost exactly replicating every step he does (this video:
).
I have a basic understanding on what he's doing but at the 46 minute mark he's making a line which is:
VBA Code:
InvItemRow = .Range("I" & ItemRow).Value
, both InvItemRow and ItemRow are Long Dims.
It's working for the guy in the video but I get the Run-time error '13': type mismatch error on that particular line.

Below the code and the highlighted part that gave me the error:
2022-01-13 (4).png
Anyone knows why this is happening? Thanks for helping out!
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi welcome to forum

try changing that part of code with this

VBA Code:
If Val(.Range("I" & ItemRow).Value) > 0 Then
    
        InvItemRow = .Range("I" & ItemRow).Value
    Else
    
        'rest of code
    
    End If

Future tip, post all your code using VBA code tags from menu bar, makes it much easier for helpers to adjust code.

Hope Helpful

Dave
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,395
Members
449,081
Latest member
JAMES KECULAH

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