![]() To look at this from a bit of a different angle, let’s consider a subroutine where we have dimensioned a variable as an integer but later attempt to set it equal to a string value. 'x enclosed in double quotes is a string and this is a mismatch for this calculation since it is not a number data type 'Sets the variable 'x' to integer value of 1 MyLastRow = ws.Cells(Rows.Count, 1).End(xlUp).Row 'Basic demonstration of how a Run-time Error ‘13’ Type mismatch is generated when the code attempts to add string (literal) data type to an Integer (numeric) datatype. ![]() Even though we dimensioned ‘x’ as a string, if we remove the quotation marks from around ‘x’, Excel actually calculates the equation for the variable ‘myNextRow’ and completes the entire subroutine without error. ![]() However, Excel is actually pretty savvy at dealing with this error.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |