john Smith72
New Member
- Joined
- Apr 21, 2024
- Messages
- 7
- Office Version
- 2016
- Platform
- Windows
Hello,
Please I need your help
VBA to auto filter by colored cells in column (H) when I change months in cell C10 (Drop List)
I have used this macro but it didn't work automatically:
Private Sub Worksheet_activate()
'
' Reapply Autofilter Macro
'
ActiveSheet.AutoFilter.ApplyFilter
With ActiveWorkbook.Worksheets("2024").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Thank You
Please I need your help
VBA to auto filter by colored cells in column (H) when I change months in cell C10 (Drop List)
I have used this macro but it didn't work automatically:
Private Sub Worksheet_activate()
'
' Reapply Autofilter Macro
'
ActiveSheet.AutoFilter.ApplyFilter
With ActiveWorkbook.Worksheets("2024").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Thank You
EXAMPLE.xlsm | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | |||
1 | No. | ID | NAME | DAYS | FROM | TILL | Cut Short | DAYS PER MONTH | |||
2 | 1 | 101 | SAMI | 10 | 01/04/2024 | 10/04/2024 | 0 | ||||
3 | 2 | 102 | CAROL | 20 | 02/04/2024 | 21/04/2024 | 0 | ||||
4 | 3 | 103 | HENRY | 40 | 03/04/2024 | 12/05/2024 | 12 | ||||
5 | 4 | 104 | DANIEL | 90 | 04/04/2024 | 02/07/2024 | 31 | ||||
6 | 5 | 105 | WILLIAM | 60 | 05/04/2024 | 03/06/2024 | 02/05/2024 | 2 | |||
7 | 6 | 106 | JOHN | 30 | 01/04/2024 | 30/04/2024 | 30/04/2024 | 0 | |||
9 | |||||||||||
10 | MONTH | 5 | Months Drop List | ||||||||
2024 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
A2:A7 | A2 | =SUBTOTAL(3,$C$2:C2) |
F2:F7 | F2 | =IFERROR(DATE(YEAR(E2),MONTH(E2),DAY(E2)+D2-1),"-") |
H2:H7 | H2 | =MAX(0,MIN(F2,IF(G2="",99999,G2),EOMONTH($C$10,0))-MAX(IF(COUNT(E2),E2,999999),$C$10)+1) |
Cells with Conditional Formatting | ||||
---|---|---|---|---|
Cell | Condition | Cell Format | Stop If True | |
H2:H8 | Cell Value | >0 | text | NO |
Cells with Data Validation | ||
---|---|---|
Cell | Allow | Criteria |
C10 | List | =$B$12:$B$23 |