Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,570
- Office Version
- 365
- 2016
- Platform
- Windows
Rich (BB code):
With ws_cd1
cnt_date = Application.WorksheetFunction.CountIf(.Columns(1), n_date)
cnt_rows = Application.WorksheetFunction.Count(.Columns(1))
rte = cnt_rows - cnt_date
.Unprotect
.Range("AP3").Value = "CORE DATA " & Chr(208)
.Range("AP3").Characters(Len(.Range("AP3").Value), 1).Font.Name = "Webdings"
.Range("A1").AutoFilter Field:=1, Criteria1:="<>n_date"
test = Application.WorksheetFunction.Subtotal(2, .columns(1)))
End With
This code filters worksheet ws_cd1 so that only rows not equal to n_date in column A are visible. The line in red (Googled) is supposed to count the number of rows in the filtered list by means of counting how many numbers are visible in column A. This number should be equal to the value calculated for rte which is the number of rows in column A minus the number of instances of n_date (which would be filtered out). cnt_date = 28; cnt_rows = 5575
The worksheet does filter, however, the value for test = 5575, which would be incorrect. test should equal 5547 (5575-28).