excel - Copy and Paste VBA with variables and unknown location -


i want copy , paste table several columns left. problem i'm using find function find string won't know exact location of table can't use range("a1:c3") example. have far:

columns("m:m").select     'types     set case1 = cells.find(what:="medium", after:=range("m7"), lookin:=xlformulas, lookat:=xlwhole, searchorder:=xlbycolumns, searchdirection:=xlnext, matchcase:=false, searchformat:=false)         case1.interior.color = rgbgreenyellow     set case2 = cells.find(what:="light", after:=range("m7"), lookin:=xlformulas, lookat:=xlwhole, searchorder:=xlbycolumns, searchdirection:=xlnext, matchcase:=false, searchformat:=false)         case2.interior.color = rgbgreenyellow     set result1 = case1.offset(4, 0)     set result2 = case2.offset(4, 0)         if result1 > result2             set section1 = case1.offset(-1, 0)             set section2 = case2.offset(10, 4)             set section = range("section1: section2")             section.copy             range("ac8").paste           end if 

but doesn't set section = range("section1:section2") give context i'm comparing 2 tables , copying on 1 greatest value


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -