VBA: Split data against two criteria

talavir666

New Member
Joined
Apr 18, 2008
Messages
9
Hi all,
I hope you can help me with this. Probably an Advanced Filter is the solution, but I'm not good at all with VBA.
I'm trying to split a table in multiple ones; the new tables should be placed next to each other (1 or 2 blank columns between them) or, as second option, to new sheets. The split will consider two criteria.

I have found something similar in below link, however the user considers 1 criteria and the new tables are placed to new sheets:

http://www.mrexcel.com/forum/showthread.php?t=511406&highlight=split+table+columns


Table:
<TABLE style="WIDTH: 296pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=392><COLGROUP><COL style="WIDTH: 74pt; mso-width-source: userset; mso-width-alt: 3136" span=4 width=98><TBODY><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid" class=xl63 height=18 width=98>ID</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid" class=xl63 width=98>Regions</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid" class=xl63 width=98>Customer</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: #3867a6 1pt solid" class=xl65 width=98>Item</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1001</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>East</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 1</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>PC</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1002</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>West</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 2</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Mobile</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1003</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>South</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 3</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Mobile</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1004</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>East</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 4</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>PC</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1005</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>East</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 5</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Other</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1006</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>West</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 6</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Other</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1007</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>East</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 7</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Other</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1008</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>West</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 8</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Other</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1009</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>South</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 9</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>PC</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1010</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Central</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 10</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>PC</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1011</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>East</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 11</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>PC</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1012</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>West</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 12</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Mobile</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1013</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>South</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 13</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Mobile</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1014</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>East</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 14</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Mobile</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1015</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>East</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 15</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>PC</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1016</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>West</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 16</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Mobile</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1017</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>East</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 17</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Mobile</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1018</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>West</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 18</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>PC</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1019</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>South</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 19</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Other</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1020</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Central</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 20</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Other</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1021</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>East</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 21</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Other</TD></TR><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; HEIGHT: 13.5pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 height=18 width=98>A-1022</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>West</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: black 1pt solid" class=xl64 width=98>Customer 22</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black; BACKGROUND-COLOR: #efefef; WIDTH: 74pt; BORDER-TOP: black; BORDER-RIGHT: #3867a6 1pt solid" class=xl66 width=98>Other</TD></TR></TBODY></TABLE>

The table should be splitted in multiple one every time that condition "Item+Regions" change. It means that considering the 3 different Items and 4 different Regions, I will expect 12 tables.

I really hope you can help me with this. If you have any question, please ask.

All the best!!
Marco
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
So far I have built a macro that consider only criteria in column D, but I would like to split the data considering a match of D+B.

Code:
Sub PagesByDescription()
Dim rRange As Range, sRange As Range, rCell As Range
Dim wSheet As Worksheet
Dim wSheetStart As Worksheet
Dim strText As String
Set wSheetStart = ActiveSheet
wSheetStart.AutoFilterMode = False
'Set a range variable to the correct item column
Set rRange = Range("D1", Range("D65536").End(xlUp))
'Delete any sheet called "UniqueList"
'Turn off run time errors & delete alert
On Error Resume Next
Application.DisplayAlerts = False
Worksheets("UniqueList").Delete
'Add a sheet called "UniqueList"
Worksheets.Add().Name = "UniqueList"
'Filter the Set range so only a unique list is created
With Worksheets("UniqueList")
rRange.AdvancedFilter xlFilterCopy, , _
Worksheets("UniqueList").Range("A1"), True
 
'Set a range variable to the unique list, less the heading.
Set rRange = .Range("A2", .Range("A65536").End(xlUp))
End With
On Error Resume Next
With wSheetStart
For Each rCell In rRange
strText = rCell
.Range("A1").AutoFilter 4, strText
Worksheets(strText).Delete
'Add a sheet named as content of rCell
Worksheets.Add().Name = strText
'Copy the visible filtered range _
(default of Copy Method) and leave hidden rows
.UsedRange.Copy Destination:=ActiveSheet.Range("A1")
ActiveSheet.Cells.Columns.AutoFit
Next rCell
End With
With wSheetStart
.AutoFilterMode = False
.Activate
End With
On Error GoTo 0
Application.DisplayAlerts = True
Sheets("UniqueList").Select
ActiveWindow.SelectedSheets.Delete
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

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