J
Jan
Using Excel 97.
I run a macro to put the header on a worksheet. Prior to the header, VBA
code is run to filter a list. The problem I am having with the formulla is
that it counts all records, not the records based on the filter that had been
set. How can I revise the formula to return the count the number of records
based on the filtered data & specific criteria. The formulas are under the
CSRTitle() below but the 2 in question are:
"Projects: At Printer=" & Application.CountIf(Range("U3:U5000"), 3) & _
" • Completed Last 30 Days=" &
Application.CountIf(Range("r3:r5000"), "Completed")
****************
Sub CSRFilter()
'
' CSRFilter Macro
'
ActiveWindow.ScrollColumn = 18
Selection.AutoFilter Field:=21, Criteria1:="<>4", Operator:=xlAnd
End Sub
***************************************
Sub CSRTitle()
'With ActiveSheet.PageSetup
' .PrintTitleRows = "$2:$2"
' .PrintTitleColumns = ""
' End With
With ActiveSheet.PageSetup
.LeftHeader = "&""Cushing Book/Bold,Bold""&T"
.CenterHeader = _
"&""Cushing Book/Bold,Bold""&16Perpetual Art Status Report (PAS) by
Label Number" & _
Chr(10) & "Total Projects in List = " & Application.Subtotal(3,
Range("c3:c5000")) _
& Chr(10) & "Projects: At Printer=" &
Application.CountIf(Range("U3:U5000"), 3) & _
" • Completed Last 30 Days=" &
Application.CountIf(Range("r3:r5000"), "Completed")
.RightHeader = "&""Cushing Book/Bold,Bold Italic""Printed: &D &14 "
.LeftFooter = "&A"
.CenterFooter = "&""Cushing Book/Bold,Bold""Chase Products
Confidential"
.RightFooter = "Page &P of &N"
.PrintGridlines = True
.CenterHorizontally = True
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
End With
End Sub
TIA
Jan
I run a macro to put the header on a worksheet. Prior to the header, VBA
code is run to filter a list. The problem I am having with the formulla is
that it counts all records, not the records based on the filter that had been
set. How can I revise the formula to return the count the number of records
based on the filtered data & specific criteria. The formulas are under the
CSRTitle() below but the 2 in question are:
"Projects: At Printer=" & Application.CountIf(Range("U3:U5000"), 3) & _
" • Completed Last 30 Days=" &
Application.CountIf(Range("r3:r5000"), "Completed")
****************
Sub CSRFilter()
'
' CSRFilter Macro
'
ActiveWindow.ScrollColumn = 18
Selection.AutoFilter Field:=21, Criteria1:="<>4", Operator:=xlAnd
End Sub
***************************************
Sub CSRTitle()
'With ActiveSheet.PageSetup
' .PrintTitleRows = "$2:$2"
' .PrintTitleColumns = ""
' End With
With ActiveSheet.PageSetup
.LeftHeader = "&""Cushing Book/Bold,Bold""&T"
.CenterHeader = _
"&""Cushing Book/Bold,Bold""&16Perpetual Art Status Report (PAS) by
Label Number" & _
Chr(10) & "Total Projects in List = " & Application.Subtotal(3,
Range("c3:c5000")) _
& Chr(10) & "Projects: At Printer=" &
Application.CountIf(Range("U3:U5000"), 3) & _
" • Completed Last 30 Days=" &
Application.CountIf(Range("r3:r5000"), "Completed")
.RightHeader = "&""Cushing Book/Bold,Bold Italic""Printed: &D &14 "
.LeftFooter = "&A"
.CenterFooter = "&""Cushing Book/Bold,Bold""Chase Products
Confidential"
.RightFooter = "Page &P of &N"
.PrintGridlines = True
.CenterHorizontally = True
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
End With
End Sub
TIA
Jan