VBA Drill Down with Filters

lharnage7331

New Member
Joined
Apr 21, 2021
Messages
1
Office Version
  1. 2016
Hello

I filter out all cells that are blank. Insert Formula. Drag Down formula. Unfilter. Clear filters. However, when i run the macro it takes the header in the column above and drags it down instead of takin that active cell and dragging the formula down to the filtered cells.

The idea is simple. Counting in progress or employees on leave or not. Just switching formulas back and forth.

PS-This file uses the subtotal function so I have to filter out non-store lines so the subtotal function works under each region/district. I'm doing something wrong with the select AG6 and Selection.Filldown I just dont know what.

Sub In_Progress()
'
' In_Progress Macro
'

'
Rows("5:5").Select
Selection.AutoFilter
ActiveSheet.Range("$A$5:$EC$3192").AutoFilter Field:=12, Criteria1:="<>"
Range("AG6").Select
ActiveCell.Formula = "=IF((V6+W6)-AF6=0,"" - "",(V6+W6)-AF6)"
Range("AG6").Select
Selection.FillDown
Range("AK6").Select
ActiveCell.Formula = "=IF((AB6+AC6)-AJ6=0,"" - "",(AB6+AC6)-AJ6)"
Range("AK6").Select
Selection.FillDown
Range("AL6").Select
ActiveCell.Formula = "=IF((AB6+AC6)-AJ6=0,"" - "",(AB6+AC6)-AJ6)"
Range("AL6").Select
Selection.FillDown
ActiveSheet.ShowAllData
Rows("5:5").Select
Range("R5").Activate
Selection.AutoFilter
Range("H1").Select
End Sub
 

Attachments

  • Capture.PNG
    Capture.PNG
    6.7 KB · Views: 2

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,136,732
Messages
5,677,439
Members
419,693
Latest member
divtjd

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
Top