I really need help, someone please help me new to VBA
So my user intrface asks user to select start and end date based on that my DATA sheet is updated and only shows those within the range , now i have another column in that filltered range and i need to count total number of DATES that are between selected dates , so basically counting total number of visible rows that meets the condition , i am having hard time can someone look at my code and let me know what i do wrong ?? here is my code
So my user intrface asks user to select start and end date based on that my DATA sheet is updated and only shows those within the range , now i have another column in that filltered range and i need to count total number of DATES that are between selected dates , so basically counting total number of visible rows that meets the condition , i am having hard time can someone look at my code and let me know what i do wrong ?? here is my code
Code:
Dim ocell As Range
Dim iCnt As Long
For i1 = 2 To Data.Range("J:J").Cells.SpecialCells(xlCellTypeVisible).SpecialCells(xlCellTypeConstants).SpecialCells(xlCellTypeLastCell).Row
Set ocell = Cells(i1, 5000)
If ((ocell.Value >= lngStart And ocell.Value <= lngEnd)) Then ' please note lngStart and lngEnd are those asking from the user
iCnt = iCnt + 1
End If
Next
TotalNumberOfAccepted = iCnt