Using a vba form, I delete a record and then go to "count" the number of events. Once the record is deleted, the countif is returning an "Overflow" error. I know it's because the range no longer equals the number of records, so how do I correct it?
VBA Code:
Sub GetPriorEvents(sEmp)
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("EventLog")
Dim myRange As Range
Set myRange = ws.Columns(2)
NumPriorEvents = Application.WorksheetFunction.CountIf(myRange, "=" & sEmp)
End Sub