Need Help Copying Autofiltered range to new worksheets

supdawg

Well-known Member
Joined
Mar 18, 2007
Messages
608
Here's a sample of my data:

DevLog

<TABLE style="BACKGROUND-COLOR: #ffffff; PADDING-LEFT: 2pt; PADDING-RIGHT: 2pt; FONT-FAMILY: Calibri,Arial; FONT-SIZE: 11pt" border=1 cellSpacing=0 cellPadding=0><COLGROUP><COL style="WIDTH: 30px; FONT-WEIGHT: bold"><COL style="WIDTH: 60px"><COL style="WIDTH: 59px"><COL style="WIDTH: 61px"><COL style="WIDTH: 61px"><COL style="WIDTH: 412px"><COL style="WIDTH: 64px"></COLGROUP><TBODY><TR style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt; FONT-WEIGHT: bold"><TD> </TD><TD>B</TD><TD>C</TD><TD>D</TD><TD>E</TD><TD>F</TD><TD>G</TD></TR><TR style="HEIGHT: 38px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">3</TD><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #c0c0c0; FONT-SIZE: 10pt; FONT-WEIGHT: bold">From Part</TD><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #c0c0c0; FONT-SIZE: 10pt; FONT-WEIGHT: bold">To Part</TD><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #c0c0c0; FONT-SIZE: 10pt; FONT-WEIGHT: bold">Start Date</TD><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #c0c0c0; FONT-SIZE: 10pt; FONT-WEIGHT: bold">Exp. Date</TD><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #c0c0c0; FONT-SIZE: 10pt; FONT-WEIGHT: bold">Deviation Description</TD><TD> </TD></TR><TR style="HEIGHT: 38px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">4</TD><TD style="FONT-SIZE: 10pt">8XR0V</TD><TD style="FONT-SIZE: 10pt">N01VP</TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">04/05/2011 </TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">04/01/2012 </TD><TD style="FONT-SIZE: 10pt"> </TD><TD>19"</TD></TR><TR style="HEIGHT: 38px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">5</TD><TD style="FONT-SIZE: 10pt">8JCGH</TD><TD style="FONT-SIZE: 10pt">77NPN</TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">03/08/2011 </TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">03/03/2012 </TD><TD style="FONT-SIZE: 10pt"> </TD><TD>19"</TD></TR><TR style="HEIGHT: 38px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">6</TD><TD style="FONT-SIZE: 10pt">77NPN</TD><TD style="FONT-SIZE: 10pt">8JCGH</TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">02/03/2011 </TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">12/03/2011 </TD><TD style="FONT-SIZE: 10pt"> </TD><TD>19"</TD></TR><TR style="HEIGHT: 38px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">7</TD><TD style="FONT-SIZE: 10pt">N01VP</TD><TD style="FONT-SIZE: 10pt">8XR0V</TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">02/03/2011 </TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">12/03/2011 </TD><TD style="FONT-SIZE: 10pt"> </TD><TD>19"</TD></TR><TR style="HEIGHT: 38px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">8</TD><TD style="FONT-SIZE: 10pt">RNMH6</TD><TD style="FONT-SIZE: 10pt">GRNWX</TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">04/04/2011 </TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">10/04/2011 </TD><TD style="FONT-SIZE: 10pt"> </TD><TD>19"</TD></TR><TR style="HEIGHT: 38px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">9</TD><TD style="FONT-SIZE: 10pt">H5J5G</TD><TD style="FONT-SIZE: 10pt">19K59</TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">09/09/2010 </TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">09/08/2011 </TD><TD style="FONT-SIZE: 10pt"> </TD><TD>20"</TD></TR><TR style="HEIGHT: 38px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">10</TD><TD style="FONT-SIZE: 10pt">2NF4M</TD><TD style="FONT-SIZE: 10pt">4DDG1</TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">09/07/2010 </TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">09/07/2011 </TD><TD style="FONT-SIZE: 10pt"> </TD><TD>22"</TD></TR><TR style="HEIGHT: 38px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">11</TD><TD style="FONT-SIZE: 10pt">1XGM4</TD><TD style="FONT-SIZE: 10pt">PRR51</TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">09/07/2010 </TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">09/07/2011 </TD><TD style="FONT-SIZE: 10pt"> </TD><TD>22"</TD></TR><TR style="HEIGHT: 38px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">12</TD><TD style="FONT-SIZE: 10pt">RNMH6</TD><TD style="FONT-SIZE: 10pt">9M62C</TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">02/25/2011 </TD><TD style="TEXT-ALIGN: right; FONT-SIZE: 10pt">08/25/2011 </TD><TD style="FONT-SIZE: 10pt"> </TD><TD>19"</TD></TR></TBODY></TABLE>
<TABLE style="BORDER-BOTTOM-STYLE: groove; BORDER-BOTTOM-COLOR: #00ff00; BORDER-RIGHT-STYLE: groove; BACKGROUND-COLOR: #fffcf9; BORDER-TOP-COLOR: #00ff00; FONT-FAMILY: Arial; BORDER-TOP-STYLE: groove; COLOR: #000000; BORDER-RIGHT-COLOR: #00ff00; FONT-SIZE: 10pt; BORDER-LEFT-STYLE: groove; BORDER-LEFT-COLOR: #00ff00"><TBODY><TR><TD>Spreadsheet Formulas</TD></TR><TR><TD><TABLE style="FONT-FAMILY: Arial; FONT-SIZE: 9pt" border=1 cellSpacing=0 cellPadding=2><TBODY><TR style="BACKGROUND-COLOR: #cacaca; FONT-SIZE: 10pt"><TD>Cell</TD><TD>Formula</TD></TR><TR><TD>G4</TD><TD>=VLOOKUP(B4,PartLookupTable!$A$1:$B$97,2,FALSE)</TD></TR><TR><TD>G5</TD><TD>=VLOOKUP(B5,PartLookupTable!$A$1:$B$97,2,FALSE)</TD></TR><TR><TD>G6</TD><TD>=VLOOKUP(B6,PartLookupTable!$A$1:$B$97,2,FALSE)</TD></TR><TR><TD>G7</TD><TD>=VLOOKUP(B7,PartLookupTable!$A$1:$B$97,2,FALSE)</TD></TR><TR><TD>G8</TD><TD>=VLOOKUP(B8,PartLookupTable!$A$1:$B$97,2,FALSE)</TD></TR><TR><TD>G9</TD><TD>=VLOOKUP(B9,PartLookupTable!$A$1:$B$97,2,FALSE)</TD></TR><TR><TD>G10</TD><TD>=VLOOKUP(B10,PartLookupTable!$A$1:$B$97,2,FALSE)</TD></TR><TR><TD>G11</TD><TD>=VLOOKUP(B11,PartLookupTable!$A$1:$B$97,2,FALSE)</TD></TR><TR><TD>G12</TD><TD>=VLOOKUP(B12,PartLookupTable!$A$1:$B$97,2,FALSE)</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>

What I would like for the code to do is to do an autofilter on column G, and each unique item in the list should be copied over into a new sheet that it names the item in G

So for example,

Rows 4:8, 12 would be autofiltered using the 19" criteria, and then copied over to a new worksheet called 19"

Then row 9 w/ header copied to new sheet called 20", and so on down the entire range.

If anyone could give me some ideas how to do this, I can figure out the small details. I just need some direction for the best way to attack the problem.

Thanks in advance as always. I hope I made sense what I am requesting.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
This is what I've done so far (I know its ugly):
Code:
 For Each cell In wb.Sheets("devlog").Range("G4:G" & Sheets("devlog").Cells(Rows.Count, "B").End(xlUp).Row)
    Set rng = wb.Sheets("devlog").Range("A3:G" & Sheets("devlog").Cells(Rows.Count, "B").End(xlUp).Row)
      With rng
        .AutoFilter Field:=7, Criteria1:=cell.Value
        .Offset(0, 0).EntireRow.Copy
        Worksheets.Add.Name = cell
        Range("A2").PasteSpecial
        .Offset(1, 0).EntireRow.Delete
        .AutoFilter
      End With
Next cell
 
Upvote 0

Forum statistics

Threads
1,224,544
Messages
6,179,430
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top