excel - VBA Match function not working with large numbers -


i made custom type, called run, , 1 of values called runmoa. stores string, 12-digit number. have array of these runs, each different moa. have sheet has column of possible moas, , i'm trying loop through array of runs , row number of run's respective moa (for finding other data in sheet).

strangely, working bunch of moas, not specific ones. did playing around, , seems error caused rounding or something. example, these moas being found in column:

200630031111, 200630021593, 200630021593,

but these ones aren't:

200000000443, 200000000603, 200000000444.

here's code loops through values (numruns length of runs array):

dim integer = 0 numruns - 1      getrun i, n, schedule, skus  next 

here's line that's supposed store row number in variable:

row = application.worksheetfunction.match(val(runs(i).runmoa), worksheets("sheet1").range(cells(2, 1), cells(n, 1))) - 1 

does function have problem when numbers big? it's giving me trouble when there lot of zeros in row, , can't find explanation that. , checked , double checked these moas in column, it's not issue of them being missing.

you using approximate match match function , data must sorted in ascending order use default match_type value of 1. use exact match match_type of 0.

row = application.worksheetfunction.match(val(runs(i).runmoa), worksheets("sheet1").range(cells(2, 1), cells(n, 1)), 0) - 1 

btw, better as,

dim rw variant rw = application.match(val(runs(i).runmoa), worksheets("sheet1").range(cells(2, 1), cells(n, 1)), 0) if not iserror(rw)     rw = rw - 1     'more operational code here else     ' match failed - deal error end if 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -