Copy only rows based on unique value in one column and paste them to another worksheet where the worksheet name equals column value

vcs0382 asked on

I have multiple worksheets in one shared folder.  There is one master worksheet but I need to break that out into separate worksheets based on each unique value in a column named ModCategory (column V).  So if I were to determine the unique values in this column by using this piece of code:


'extract a list of unique ModCategory in this column
ws1.Columns("V:V").Copy _
ws1.Columns("BQ:BQ").AdvancedFilter _
  Action:=xlFilterCopy, _
  CopyToRange:=Range("BP1"), Unique:=True
r = Cells(Rows.Count, "BP").End(xlUp).Row

'set up Criteria Area
Range("BQ1").Value = Range("V2").Value


In the end what I would like to do is extract only the rows for each unique value found, copy those rows and columns (A:BO) to another worksheet within that same shared folder where first two characters of that worksheet equal the unique values found in the master worksheet.  This would loop through until all the worksheets in that folder have been found and rows have been copied into each one. 


1 person had this question

Abuse history