Hello Gurus,
I cannot figure out why this doesn't work for data with 2017 dates in it... it works for 2016 just fine... any help would be AMAZING!
Sub PullNumbers()
Dim DateARR As Variant, SummaryARR As Variant, ws As Worksheet
Dim LR As Long, d As Long, s As Long, CNT As Long
For Each ws In ActiveWorkbook.Worksheets
With ws
.Range("O:P").Clear
LR = .Range("G" & .Rows.Count).End(xlUp).Row
ReDim DateARR(1 To LR, 1 To 1)
ReDim SummaryARR(1 To LR, 1 To 2)
DateARR = .Range("G1:G" & LR)
SummaryARR(1, 1) = "Date"
SummaryARR(1, 2) = "Count"
s = 2
SummaryARR(2, 1) = CDate(Left(DateARR(2, 1), 10))
For d = 2 To LR
If CDate(Left(DateARR(d, 1), 10)) = SummaryARR(s, 1) Then
SummaryARR(s, 2) = SummaryARR(s, 2) + 1
Else
s = s + 1
If Month(CDate(Left(DateARR(d, 1), 10))) <> Month(SummaryARR(s - 1, 1)) Then
SummaryARR(s, 1) = "Total:"
SummaryARR(s, 2) = CNT
CNT = 0
s = s + 1
End If
SummaryARR(s, 1) = CDate(Left(DateARR(d, 1), 10))
SummaryARR(s, 2) = SummaryARR(s, 2) + 1
End If
CNT = CNT + 1
If d = LR Then
s = s + 1
SummaryARR(s, 1) = "Total:"
SummaryARR(s, 2) = CNT
CNT = 0
End If
Next d
.Range("O1:P" & LR) = SummaryARR
LR = .Range("O" & .Rows.Count).End(xlUp).Row
With .Range("O1:P" & LR)
.EntireColumn.AutoFit
.FormatConditions.Add Type:=xlExpression, Formula1:="=$O1=""Total:"""
.FormatConditions(.FormatConditions.Count).SetFirstPriority
.FormatConditions(1).Font.Bold = True
With .FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 5296274
.TintAndShade = 0
End With
.FormatConditions(1).StopIfTrue = False
End With
.Range("O1:P1").Font.Bold = True
End With
Next ws
End Sub
Bookmarks