excel - Comparing Columns Not Working Due to Apostrophe -


i trying compare 2 columns on different sheets following code:

for = 2 lastrow22     j = 2 lastrow33         if ws2.cells(i, 81) = ws3.cells(j, 10)             ws2.cells(i, 1).interior.color = vbgreen         end if     next j next 

i know items in columns match loop not seem find match. further inspected columns , on 1 sheet column cells leading apostrophe , on other sheet not.

i tried looping through sheet , removing apostrophe following code , did not work:

for = 2 lastrow33     if ws3.cells(i, 10) "'*"         x = replace(ws2.cells(i, 1), "'", "")         ws3.cells(i, 10) = x     end if next 

any tips on might able match?

use cstr convert string before comparing. works strings numbers there no type mismatch errors.

final code:

for = 2 lastrow22     j = 2 lastrow33         if cstr(ws2.cells(i, 81)) = cstr(ws3.cells(j, 10))             ws2.cells(i, 1).interior.color = vbgreen         end if     next j next 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -