excel - Filter based on multiple cell values in separate sheet then loop through results -



excel - Filter based on multiple cell values in separate sheet then loop through results -

ok,

hopefully isn't convoluted. i'm trying filter big number of transactions based on client id number. have list of 60 of import customers need track in separate sheet. has client id number , name , other data. everyday i'm taking 20,000 transactions , filtering them manually. going through , copying , pasting first instance of each transaction day sheet.

so far have:

dim arr() variant arr = sheet2.range(“a1:a60”) lastrow = .range("a" & .rows.count).end(xlup).row activesheet.range(“a1:a” & lastrow).autofilter field:=1,_ criterial:=arr, operator:=xlfiltervalues dim r long, endrow long, pasterowindex long pasterowindex = 1 r = 1 lastrow if cells(r, columns("a").column).value <> cells(r + 1, columns("a").column).value rows(r).select selection.copy sheets("sheet3").select rows(pasterowindex).select activesheet.paste pasterowindex = pasterowindex + 1 sheets("sheet1").select end if next r

as of it's untested because i'm on vacation. code proper? if not, can better?

thanks

a few notes:

change columns("a").column 1, there no need have since aren't checking other columns.

for lastrow may easier utilize cells(1,1).end(xldown).row

from can see if command checking cell after same id number. imply lastly transaction id number 1 beingness passed. if have headings first row utilize

if cells(r, columns("a").column).value <> cells(r - 1 1, columns("a").column).value

and start r = 2

also seems though when filtering filtering column. alter next , should work

lastcol = cells(1,1).end(xltoright).column

activesheet.range(cells(1,1),cells(lastrow,lastcol)).autofilter field:=1,_

criterial:=arr, operator:=xlfiltervalues

for code simplicity can utilize dim r, endrow, pasterowindex long , not forget define dim lastrow integer , similar lastcol if decide utilize it.

if there still issues when homecoming please sense free allow me know.

excel vba excel-vba

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -