willsmith919
New Member
- Joined
- Jan 17, 2014
- Messages
- 2
I am trying to get a list to populate and count store visits based on dates. I've got a lengthy macro that will populate all of my lists, but my Countif will only work for the first value that populates and will return a 0 for all other values. The code I'm using shortened is:
Dim storeCount As Integer
Dim xRow As Integer
Dim newDate as Date
xRow = 1
Do Until Sheet3.Cells(xRow, 1) = Empty
xRow = xRow + 1
Loop
storeCount = Sheet3.Application.WorksheetFunction.countIf(Range("C1:C" & xRow), newDate)
As I am running through all the other steps in my macro, the first time I run through storeCount will come in as the correct #, but as it loops through to the next newDate variable (code for this is not included, I can post it if needed) storeCount comes back as 0. I've checked that my range is staying consistent. Any ideas why this is happening?
Dim storeCount As Integer
Dim xRow As Integer
Dim newDate as Date
xRow = 1
Do Until Sheet3.Cells(xRow, 1) = Empty
xRow = xRow + 1
Loop
storeCount = Sheet3.Application.WorksheetFunction.countIf(Range("C1:C" & xRow), newDate)
As I am running through all the other steps in my macro, the first time I run through storeCount will come in as the correct #, but as it loops through to the next newDate variable (code for this is not included, I can post it if needed) storeCount comes back as 0. I've checked that my range is staying consistent. Any ideas why this is happening?