Excel VBA Find.Method , searching for 2 Values in a row writing a value -


i want search within table e.g.

a b c
d e c
h i
h c
values

"a" , "c" , put value "value" cell in rows both values have been found.
new whole topic searched first on web find pieces of code me.

dim firstaddress string dim secondaddress string dim myarr variant dim myarr2 variant dim rng range dim row range dim long dim b long application     .screenupdating = false     .enableevents = false end myarr = array("a") myarr2 = array("c") sheets("sheet1").range("f:f")     .offset(0, 27).clearcontents     = lbound(myarr) ubound(myarr)         set rng = .find(what:=myarr(i), after:=.cells(.cells.count), lookin:=xlvalues, lookat:=xlwhole, searchorder:=xlbyrows, searchdirection:=xlnext, matchcase:=false)          if not rng nothing             firstaddress = rng.address                                 set rng2 = rng.entirerow.find(what:=myarr2(i), after:=.cells(.cells.count), lookin:=xlvalues, lookat:=xlwhole, searchorder:=xlbyrows, searchdirection:=xlnext, matchcase:=false)                     if not row nothing                         secondadress = row.address                                                     rng.offset(0, 27).value = "value"                             set row = .findnext(row)                  set rng = .findnext(rng)             loop while not rng nothing , rng.address <> firstaddress         end if     next end  application     .screenupdating = true     .enableevents = true end 

it worked me searching 1 value .find method, struggle search rows contain both values. (the array in case want search more 1 value, have @ beginning or d , c in third column)

do have idea? dont how implemented several loops.

thanks!

advanced filtering identify rows matching criteria.

data > sort & filter > advanced

microsoft support - filter using advanced criteria

advanced filter


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -