crashing1912
New Member
- Joined
- Sep 8, 2011
- Messages
- 19
Hi all,
I've managed to modify some code I've found on the site (Thanks RoyUK!), that I would like to perform an advanced filter on my data and create a sheet for each unique value, then copy and paste the data for the unique value. The code below, currently works if I use the file I downloaded with the code in it, but when I go to use it in a different workbook, the code no longer works.
The specific piece of code that keeps stopping the run is:
rData.Columns(8).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Cells(1, .Columns.count), Unique:=True
I receive the following error message:
"The command could not be completed by using the range specified. Select a single cell within the range and try the command again."
Some sample data:
<TABLE style="WIDTH: 708pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=943><COLGROUP><COL style="WIDTH: 23pt; mso-width-source: userset; mso-width-alt: 1133" width=31><COL style="WIDTH: 59pt; mso-width-source: userset; mso-width-alt: 2852" width=78><COL style="WIDTH: 68pt; mso-width-source: userset; mso-width-alt: 3291" width=90><COL style="WIDTH: 32pt; mso-width-source: userset; mso-width-alt: 1572" width=43><COL style="WIDTH: 74pt; mso-width-source: userset; mso-width-alt: 3584" width=98><COL style="WIDTH: 45pt; mso-width-source: userset; mso-width-alt: 2194" width=60><COL style="WIDTH: 57pt; mso-width-source: userset; mso-width-alt: 2779" width=76><COL style="WIDTH: 22pt; mso-width-source: userset; mso-width-alt: 1060" width=29><COL style="WIDTH: 45pt; mso-width-source: userset; mso-width-alt: 2194" width=60><COL style="WIDTH: 65pt; mso-width-source: userset; mso-width-alt: 3181" width=87><COL style="WIDTH: 54pt; mso-width-source: userset; mso-width-alt: 2633" width=72><COL style="WIDTH: 57pt; mso-width-source: userset; mso-width-alt: 2779" width=76><COL style="WIDTH: 50pt; mso-width-source: userset; mso-width-alt: 2450" width=67><COL style="WIDTH: 57pt; mso-width-source: userset; mso-width-alt: 2779" width=76><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: silver; WIDTH: 23pt; HEIGHT: 12.75pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 height=17 width=31>MED</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 59pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=78>Auth</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 68pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=90>SERVICE_DATE</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 32pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=43>EST</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 74pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=98>ESTIMATE</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 45pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=60>INV_NO</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 57pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl72 width=76>ACTUAL </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 22pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=29>CLT</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 45pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=60>PRODUCT</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 65pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=87>INVOICE_DATE</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 54pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl72 width=72>DUE_DATE </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 57pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl72 width=76>NET </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 50pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl72 width=67>COMM </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 57pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl72 width=76>GROSS </TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5 0.5pt solid; BACKGROUND-COLOR: transparent; WIDTH: 23pt; HEIGHT: 12.75pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 height=17 width=31>T</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 59pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=78 align=right>60011</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>SEP/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 32pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=43 align=right>22999</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 74pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=98>2010 In</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 45pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=60 align=right>77775</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 57pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl68 width=76>886.50 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 22pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=29>B</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 45pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=60>BA</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 65pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=87>SEP13/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 54pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl67 width=72>OCT28/11 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 57pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl68 width=76>765.00 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 50pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl68 width=67>121.50 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 57pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl68 width=76>900.00 </TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 height=17>I</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>60011</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>JUN/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>33333</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>Q2 UP</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 45pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=60 align=right>77776</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>4.63 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>A</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>CA</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>SEP13/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl74>OCT28/11 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>4.00 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>0.63 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>4.70 </TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 height=17>I</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>60011</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>JUL/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>44334</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>Q3 UP</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 45pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=60 align=right>77777</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>(265.38)</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>A</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>NA</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>SEP13/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl74>OCT28/11 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>(228.99)</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>(36.39)</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>(269.42)</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 height=17>I</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>60011</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>SEP/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>344543</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>Q3 UP SOUTH</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 45pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=60 align=right>77778</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>98,080.60 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>C</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>CA</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>SEP13/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl74>OCT28/11 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>84,638.10 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>13,442.50 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>99,574.21 </TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 height=17>R</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>30021</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>SEP/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>456532</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>Q3 RA</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 45pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=60 align=right>77779</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>6,501.00 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>C</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>BA</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>SEP13/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl74>OCT28/11 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>5,610.00 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>891.00 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>6,600.00 </TD></TR></TBODY></TABLE>
Code:
Dim ws As Worksheet
Dim wsNew As Worksheet
Dim rData As Range
Dim rCl As Range
Dim Client As String
'name of the worksheet referencing
Set ws = Sheet1 'change this if necessary
'extract a list of unique names
'first clear existing list
Range("I1").Select
With ws
Set rData = .Cells(1, 14).CurrentRegion 'change number of columns and rows as necessary
.Columns(.Columns.count).Clear
rData.Columns(8).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Cells(1, .Columns.count), Unique:=True
'change column(8) to desired column with the client in it
For Each rCl In .Range(.Cells(2, .Columns.count), .Cells(.Rows.count, .Columns.count).End(xlUp))
Client = rCl.Text
'new sheet required
Set wsNew = Sheets.Add
wsNew.Move After:=Worksheets(Worksheets.count) 'move to end
wsNew.Name = Client
'pasting the column widths
Sheets("Sheet1").Select
Columns("A:N").Select
Application.CutCopyMode = False
Selection.Copy
Sheets(Client).Select
Columns("A:N").Select
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
'AutoFilter & copy to relevant sheet
rData.AutoFilter Field:=8, Criteria1:=Client 'change the autofilter field to the column with client
rData.Copy Destination:=Worksheets(Client).Cells(1, 1)
Next rCl
End With
ws.Columns(Columns.count).ClearContents 'remove temporary list
rData.AutoFilter 'switch off AutoFilter
Any help on this would be very helpful. Thanks!
I've managed to modify some code I've found on the site (Thanks RoyUK!), that I would like to perform an advanced filter on my data and create a sheet for each unique value, then copy and paste the data for the unique value. The code below, currently works if I use the file I downloaded with the code in it, but when I go to use it in a different workbook, the code no longer works.
The specific piece of code that keeps stopping the run is:
rData.Columns(8).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Cells(1, .Columns.count), Unique:=True
I receive the following error message:
"The command could not be completed by using the range specified. Select a single cell within the range and try the command again."
Some sample data:
<TABLE style="WIDTH: 708pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=943><COLGROUP><COL style="WIDTH: 23pt; mso-width-source: userset; mso-width-alt: 1133" width=31><COL style="WIDTH: 59pt; mso-width-source: userset; mso-width-alt: 2852" width=78><COL style="WIDTH: 68pt; mso-width-source: userset; mso-width-alt: 3291" width=90><COL style="WIDTH: 32pt; mso-width-source: userset; mso-width-alt: 1572" width=43><COL style="WIDTH: 74pt; mso-width-source: userset; mso-width-alt: 3584" width=98><COL style="WIDTH: 45pt; mso-width-source: userset; mso-width-alt: 2194" width=60><COL style="WIDTH: 57pt; mso-width-source: userset; mso-width-alt: 2779" width=76><COL style="WIDTH: 22pt; mso-width-source: userset; mso-width-alt: 1060" width=29><COL style="WIDTH: 45pt; mso-width-source: userset; mso-width-alt: 2194" width=60><COL style="WIDTH: 65pt; mso-width-source: userset; mso-width-alt: 3181" width=87><COL style="WIDTH: 54pt; mso-width-source: userset; mso-width-alt: 2633" width=72><COL style="WIDTH: 57pt; mso-width-source: userset; mso-width-alt: 2779" width=76><COL style="WIDTH: 50pt; mso-width-source: userset; mso-width-alt: 2450" width=67><COL style="WIDTH: 57pt; mso-width-source: userset; mso-width-alt: 2779" width=76><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: silver; WIDTH: 23pt; HEIGHT: 12.75pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 height=17 width=31>MED</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 59pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=78>Auth</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 68pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=90>SERVICE_DATE</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 32pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=43>EST</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 74pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=98>ESTIMATE</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 45pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=60>INV_NO</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 57pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl72 width=76>ACTUAL </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 22pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=29>CLT</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 45pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=60>PRODUCT</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 65pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl71 width=87>INVOICE_DATE</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 54pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl72 width=72>DUE_DATE </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 57pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl72 width=76>NET </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 50pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl72 width=67>COMM </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: silver; WIDTH: 57pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl72 width=76>GROSS </TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5 0.5pt solid; BACKGROUND-COLOR: transparent; WIDTH: 23pt; HEIGHT: 12.75pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 height=17 width=31>T</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 59pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=78 align=right>60011</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>SEP/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 32pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=43 align=right>22999</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 74pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=98>2010 In</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 45pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=60 align=right>77775</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 57pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl68 width=76>886.50 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 22pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=29>B</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 45pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=60>BA</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 65pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=87>SEP13/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 54pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl67 width=72>OCT28/11 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 57pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl68 width=76>765.00 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 50pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl68 width=67>121.50 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 57pt; BORDER-TOP: #d0d7e5 0.5pt solid; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl68 width=76>900.00 </TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 height=17>I</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>60011</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>JUN/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>33333</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>Q2 UP</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 45pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=60 align=right>77776</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>4.63 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>A</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>CA</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>SEP13/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl74>OCT28/11 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>4.00 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>0.63 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>4.70 </TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 height=17>I</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>60011</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>JUL/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>44334</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>Q3 UP</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 45pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=60 align=right>77777</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>(265.38)</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>A</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>NA</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>SEP13/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl74>OCT28/11 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>(228.99)</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>(36.39)</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>(269.42)</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 height=17>I</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>60011</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>SEP/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>344543</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>Q3 UP SOUTH</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 45pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=60 align=right>77778</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>98,080.60 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>C</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>CA</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>SEP13/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl74>OCT28/11 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>84,638.10 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>13,442.50 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>99,574.21 </TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 height=17>R</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>30021</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>SEP/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69 align=right>456532</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>Q3 RA</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; WIDTH: 45pt; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl66 width=60 align=right>77779</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>6,501.00 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>C</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>BA</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl69>SEP13/11</TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl74>OCT28/11 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>5,610.00 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>891.00 </TD><TD style="BORDER-BOTTOM: #d0d7e5 0.5pt solid; BORDER-LEFT: #d0d7e5; BACKGROUND-COLOR: transparent; BORDER-TOP: #d0d7e5; BORDER-RIGHT: #d0d7e5 0.5pt solid" class=xl73>6,600.00 </TD></TR></TBODY></TABLE>
Code:
Dim ws As Worksheet
Dim wsNew As Worksheet
Dim rData As Range
Dim rCl As Range
Dim Client As String
'name of the worksheet referencing
Set ws = Sheet1 'change this if necessary
'extract a list of unique names
'first clear existing list
Range("I1").Select
With ws
Set rData = .Cells(1, 14).CurrentRegion 'change number of columns and rows as necessary
.Columns(.Columns.count).Clear
rData.Columns(8).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Cells(1, .Columns.count), Unique:=True
'change column(8) to desired column with the client in it
For Each rCl In .Range(.Cells(2, .Columns.count), .Cells(.Rows.count, .Columns.count).End(xlUp))
Client = rCl.Text
'new sheet required
Set wsNew = Sheets.Add
wsNew.Move After:=Worksheets(Worksheets.count) 'move to end
wsNew.Name = Client
'pasting the column widths
Sheets("Sheet1").Select
Columns("A:N").Select
Application.CutCopyMode = False
Selection.Copy
Sheets(Client).Select
Columns("A:N").Select
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
'AutoFilter & copy to relevant sheet
rData.AutoFilter Field:=8, Criteria1:=Client 'change the autofilter field to the column with client
rData.Copy Destination:=Worksheets(Client).Cells(1, 1)
Next rCl
End With
ws.Columns(Columns.count).ClearContents 'remove temporary list
rData.AutoFilter 'switch off AutoFilter
Any help on this would be very helpful. Thanks!