Type mismatch (Error 13)

helplessnoobatexcel

New Member
Joined
Dec 15, 2023
Messages
45
Office Version
  1. 365
Platform
  1. Windows
1702974419038.png

Hi All, I have this error in my code Type Mismatch (Error 13) that I am unable to rectify. Any idea on how I can do so? Btw I moused over the error during debugging and found my UserRow to be "".
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Is the value that is in cell B12 a number?

Note:
VBA Code:
Dim UserRow, SheetCol as Long
Will only define SheetCol with a type, UserRow is left with no type
Try:
VBA Code:
Dim UserRow as Long, SheetCol as Long
 
Upvote 0
Is the value that is in cell B12 a number?

Note:
VBA Code:
Dim UserRow, SheetCol as Long
Will only define SheetCol with a type, UserRow is left with no type
Try:
VBA Code:
Dim UserRow as Long, SheetCol as Long
Hi George, yep the value in cell B12 is a number.
I've tried your proposed solution and it gives me another problem which has the same error type of mismatch (error 13). Is there any possible underlying problems in this code? Thanks!
1702975357658.png
 
Upvote 0
What is the value you have in cell B12?

I ask as the new error row would suggest that B12 is either not a number or contains a decimal place etc.
 
Upvote 0
What is the code that puts the value into cell B12?

Is the cell B12 formatted as text?

What do you see when you hover over '.Range("B12").Value

The new error is suggesting that VBA does not see B12 as a number, it may have a space on the end for example.
 
Upvote 0
I've tried your proposed solution and it gives me another problem which has the same error type of mismatch (error 13).

Make sure there are no errors like #N/A or #REF! in the cells as they will cause a Type Mismatch error when a variable is trying to be assigned to it.
 
Upvote 0
What is the code that puts the value into cell B12?

Is the cell B12 formatted as text?

What do you see when you hover over '.Range("B12").Value

The new error is suggesting that VBA does not see B12 as a number, it may have a space on the end for example.
This is the formula for cell B12
1702976436128.png

Nope, cell B12 is formatted as a number with no decimal places
I see .'Range("B12").Value = "". Does this mean that it isn't registering anything in my User Row?
 
Upvote 0
Make sure there are no errors like #N/A or #REF! in the cells as they will cause a Type Mismatch error when a variable is trying to be assigned to it.
Hi Trebor,
Thanks for your suggestion, nope I've checked, there isn't any errors such as #N/A or #REF! as of currently. Only #N/A will be displayed in another cell to indicate that the user has not keyed in a password
 
Upvote 0
This means that your formula is hitting the IFERROR part and returning ""

You need to look at why your match is not working. I guess that UserName is a named range, maybe it does not contain a match to B9.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,954
Members
449,096
Latest member
Anshu121

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