vba - Why i get an "type mismatch" error? -


i got question, have line dim i, j, x, y, labels integer , , when want use labels variable in following way inside cycle error: labels = cint(dbrange.rows(i).item(10).value) , consider dbrange 1 database on worksheet 10 columns , 10 rows example. why i'm getting "type mismatch" error if variable i integer, , variable labels integer, , if i'm converting cell value integer cint function?

@tomalak correct i, j, x, , y variants , not integers. label integer, variants can slow process , should avoided.

with modern computing power , volume of work, consider integer obsolete long taking place:-

a integer can hold number between -32768 , 32767

a long can hold number between -2147483648 , 2147483647

if dbrange.rows(i).item(10).value ever contained value outside of integer range or acted non-numeric containing non-numeric characters (i.e. space), error occur. if following way inside cycle building values end outside of integer range error occur.

to confirm, not variable accepting cint() value causing error, act of cint() causing error.

my first debugging step declare variables fully: - dim integer dim j integer dim x integer dim y integer dim labels integer

the second debugging step convert them long.

finally use f8, show variable , so can give answer issue in , instantly, history on error important part of finding solution.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -