Advanced Filter that Add Row Between Each Newly Encountered Criteria

Mchlebo

New Member
Joined
Jan 11, 2016
Messages
5
Very new. First Post.

I am building a tool for a manager to input employee schedules, see total hours and dollars in real time, and push out a csv file that will later be uploaded into our clock in system. So far, so good.

I have an advanced filter that pulls data for each employee based on what store they work at, sorted by department. The filter pulls data from an active directory to keep all employee data current (wage, store, dept, etc).

The team would prefer this advanced filter to also add a space between each department, so they can visually sort out a schedule for each.

Example of the current filter:
Dept
1
1
1
2
3
3
3
4


What they want to see:
Dept
1
1
1

2

3
3
3

4




My current VBA:

Sub AdvancedFilter()
'
' AdvancedFilter Macro
'

'
Range("A5").Select
Sheets("Data Source Extract").Range("Table5[#All]").AdvancedFilter Action:= _
xlFilterCopy, CriteriaRange:=Sheets("Data Validation").Range("F1:J2"), _
CopyToRange:=Range("Table4[[Dept]:[Column10]]"), Unique:=False

End Sub


I hope this is enough info. Any advice would be much appreciated.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
When are you wanting the spaces to be put in?

After you have copied the filtered range to Table 4?
 
Upvote 0
When are you wanting the spaces to be put in?

After you have copied the filtered range to Table 4?


That would probably work. Ideally it would be great for it to be built into the advanced filter process itself, so it knows to skip a row before adding the next department.
 
Upvote 0
I may be wrong on this but I don't think inserting a row on a filtered column will necessarily place the row where it needs to be once unfiltered
 
Upvote 0

Forum statistics

Threads
1,214,528
Messages
6,120,065
Members
448,941
Latest member
AlphaRino

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