vba - Comparing Two Datas in 2 columns -
i taking first course vba excel. new in vba perharps, help, gain knowledge in doing best in vba programming. need compare 2 columns. need same data , highlight happens, same data on same row ones highlighted. data in different row ignored. me please.
here code code:
sub compare() dim col1 range dim col2 range set col1 = application.inputbox("select first column compare", type:=8) if col1.columns.count > 1 until col1.columns.count = 1 msgbox "you can select 1 column" set col1 = application.inputbox("select first column compare", type:=8) loop end if set col2 = application.inputbox("select second column compare", type:=8) if col2.columns.count > 1 until col2.columns.count = 1 msgbox "you can select 1 column" set col2 = application.inputbox("select second column compare", type:=8) loop end if if col2.rows.count <> col1.rows.count until col2.rows.count = col1.rows.count msgbox "the second column must same size first" set col2 = application.inputbox("select second column compare", type:=8) loop end if if col1.rows.count = 65536 set col1 = range(col1.cells(1), col1.cells(activesheet.usedrange.rows.count)) set col2 = range(col2.cells(1), col2.cells(activesheet.usedrange.rows.count)) end if dim intcell long intcell = 1 col1.rows.count if col1.cells(intcell) = col2.cells(intcell) col1.cells(intcell).interior.color = vbyellow col2.cells(intcell).interior.color = vbyellow end if next end sub
Comments
Post a Comment