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 ... , datuis 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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -