excel - Advanced.Filter VBA -


i have code far, sheet 2, how can alter code include multiple sheets this? complete newb here. :

sub extractuniquevalues()      sheet1.range("c:c").advancedfilter xlfiltercopy, , sheet4.range("c1"), true     sheet2.range("c:c").advancedfilter xlfiltercopy, , sheet4.range("c1"), true  end sub 

you can that:

filter data in place:

sub extractuniquevalues()     dim wks excel.worksheet      each wks in excel.activeworkbook.worksheets         call wks.range("c:c").advancedfilter(xlfilteraction.xlfilterinplace, , , true)     next wks  end sub 

filter data , paste them new worksheet:

sub extractuniquevalues2()     dim wks excel.worksheet     dim wkssummary excel.worksheet     '----------------------------------------------------------------------------------      on error resume next     set wkssummary = excel.thisworkbook.worksheets("unique data")     on error goto 0      if wkssummary nothing         set wkssummary = excel.thisworkbook.worksheets.add         wkssummary.name = "unique data"     end if       'iterate through worksheets, skip [summary] worksheet.     each wks in excel.activeworkbook.worksheets          wkssummary              if wks.name <> .name                 if application.worksheetfunction.counta(wks.range("c:c"))                     call wks.range("c:c").advancedfilter(xlfiltercopy, , .cells(.cells(.rows.count, 1).end(xlup).row + 1, 1), true)                 end if             end if          end      next wks  end sub 

unique data each worksheet printed in first column of new worksheet called unique data.

this method filters data each worksheet separately, if there example value a in sheet1 , value a in sheet2, there 2 entries a in result list.


note first value considered header , can duplicated in result list.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

php - How do you embed a video into a custom theme on WordPress? -