excel - True for all values but 1, cannot figure out why (VBA) -
my loop goes on range of cells , compares values:
for k = 7 wsplany.usedrange.rows.count if wsplany.cells(k, 1) = datu 'code here end if next k
basically cells cells numbers, 1, 2, 3 ...
, datu
is number too. works value 1 , cannot figure out why.
even debug.printing like: wsplany.cells(k, 1), datu , comparing them next line confirms if value 2 or higher, return true line, if 1 exactly, returns false if comparing other number (but see same side side in debug.print).
a simple addition of 1 line turn values integers
no matter data type before solved problem.
for k = 7 wsplany.usedrange.rows.count 'turns values integers first wsplany.cells(k, 1).value = cint(wsplany.cells(k,1)) if wsplany.cells(k, 1) = datu 'code here end if next k
Comments
Post a Comment