Hi Guys after stepping through the code using f8 at this point in the code last line shown below (.Columns("B:D").Delete) on Sample 1 I am left with the following:
'Sub Advanced_Filter_Sheet3()
Dim wsSrc As Worksheet: Set wsSrc = Sheets("Sheet1")
Dim wsDest As Worksheet: Set wsDest = Sheets("Sheet2")
Dim wsDestSum As Worksheet: Set wsDestSum = Sheets("Sheet3")
Dim i As Long
With wsDest
.UsedRange.Clear
wsSrc.Range("B8:B22,E8:E22,I8:I22,K8:K22").Copy .Range("B10")
For i = 15 To .Range("B" & .Rows.Count).End(xlUp).Row
If .Range("E" & i).Value <> "" Then
.Range("E" & i).Offset(0, -1).Value = .Range("E" & i).Value
End If
Next i
.Columns("E").Delete
.Range("B10:D40").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=.Range("E10"), Unique:=True
.Columns("B:D").Delete
Excel Workbook |
---|
|
---|
| B | C | D | E | F | G |
---|
10 | ITEM | ACC No. | JOB NO. A | ITEM | ACC No. | JOB NO. A |
---|
11 | Cat | 10005 | 1234 | Cat | 10005 | 1234 |
---|
12 | Dog | 10003 | 1234 | Dog | 10003 | 1234 |
---|
13 | Rat | 10006 | 1234 | Rat | 10006 | 1234 |
---|
14 | Pig | 10008 | 1234 | Pig | 10008 | 1234 |
---|
15 | Rat | 10006 | 1234 | Dog | 10003 | 9876 |
---|
16 | Dog | 10003 | 9876 | Pig | 10008 | 9876 |
---|
17 | Dog | 10003 | 1234 | Dog | 10003 | 6789 |
---|
18 | Pig | 10008 | 9876 | Bird | 10110 | 1111 |
---|
19 | Cat | 10005 | 1234 | Horse | 10118 | 3232 |
---|
20 | Dog | 10003 | 6789 | Dog | 10003 | 3245 |
---|
21 | Bird | 10110 | 1111 | Bull | 18888 | 8787 |
---|
22 | Horse | 10118 | 3232 | | | |
---|
23 | Dog | 10003 | 3245 | | | |
---|
24 | Bull | 18888 | 8787 | | | |
---|
25 | | | | | | |
---|
|
---|
At the same point in the code of Sample2 I am left with this:
As you can see both columns are the same here not like in Samlpe 1 where it shows the differences.
Excel Workbook |
---|
|
---|
| B | C | D | E | F | G |
---|
10 | ITEM | ACC No. | JOB NO. A | ITEM | ACC No. | JOB NO. A |
---|
11 | Field Hand Services | 9-0120 | 1046 | Field Hand Services | 9-0120 | 1046 |
---|
12 | SURVEYS | 9-0400 | 9999 | SURVEYS | 9-0400 | 9999 |
---|
13 | Petty Cash | 1-1109 | 1069 | Petty Cash | 1-1109 | 1069 |
---|
14 | Training/Conferences/Courses | 9-0125 | 1021 | Training/Conferences/Courses | 9-0125 | 1021 |
---|
15 | Drafting & Computing Services | 9-0115 | 1046 | Drafting & Computing Services | 9-0115 | 1046 |
---|
16 | Payroll Recoveries | 6-1099 | 1000 | Payroll Recoveries | 6-1099 | 1000 |
---|
17 | Staff Paye | 2-2101 | 1021 | Staff Paye | 2-2101 | 1021 |
---|
18 | Management Fees | 4-3000 | 2070 | Management Fees | 4-3000 | 2070 |
---|
19 | Management Fees | 4-3000 | 2020 | Management Fees | 4-3000 | 2020 |
---|
20 | Director Fees | 6-1091 | 2047 | Director Fees | 6-1091 | 2047 |
---|
21 | Vehicle Operating Costs | 9-0760 | 2069 | Vehicle Operating Costs | 9-0760 | 2069 |
---|
22 | | | | | | |
---|
23 | | | | | | |
---|
24 | | | | | | |
---|
25 | | | | | | |
---|
|
---|