VBA Excel To Match 2 columns on A with 2 columns on B and return value -


i need vba excel script compare columns & b in worksheet 1 against & b in worksheet 2 if match found return column c worksheet one.

ive can in excel using formula speed im after doing via vba quicker , id prefer final output of table contain values instead of formulas.

ive done lot of digging cant find piticular requirement.

any on gratefully appreciated.

this th excel formula im using

{=iferror(index(sqldata!d:d,match(1,(sqldata!a:a=a2)*(sqldata!b:b=b2),0)),"0")}

sub stridhan()  dim c range, d range, lr long dim ws1 worksheet, ws2 worksheet dim rng1 range, rng2 range  application .screenupdating = false .calculation = xlcalculationmanual end  'rename sheet1 , sheet2 set ws1 = thisworkbook.sheets("sheet1") set ws2 = thisworkbook.sheets("sheet2")  set rng1 = ws1.range("a2", ws1.range("a" & ws1.cells(rows.count, 1).end(xlup).row)) set rng2 = ws2.range("a2", ws2.range("a" & ws2.cells(rows.count, 1).end(xlup).row))  ws2     lr = .cells(rows.count, 3).end(xlup).row     if lr > 1 .range("c2", "c" & lr).clearcontents end  each c in rng2 each d in rng1     if c = d         if c.offset(0, 1) = d.offset(0, 1)             c.offset(0, 2).value = d.offset(0, 2).value             goto nextone         end if     end if next d nextone: next c  application .screenupdating = true .calculation = xlcalculationautomatic end  end sub 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -