Wilder1626
asked on
VB6 - Find days falling on a Monday in MSHFlexgrid1 column 2
Hi,
I have this MSHFlexgrid1 col 2 that have different days in it with format "YYYY-MM-DD".
I would like to count the number of dates in this column falls on a Monday.
I tried with below code:
But if you try the sample project in attachment, i should get 2 records but it tells me ZERO.
How can i fix this?
Thanks for your help.
I have this MSHFlexgrid1 col 2 that have different days in it with format "YYYY-MM-DD".
I would like to count the number of dates in this column falls on a Monday.
I tried with below code:
Private Sub cmdCount_VBMonday_Click()
total1 = 0
With MSHFlexGrid1
For lngRow = 1 To .Row - 1
If Weekday(Format(.TextMatrix(lngRow, 2), "yyyy-mm-dd")) = vbMonday Then
total1 = total1 + 1
End If
Next
End With
txtVB_Monday_count = total1
End Sub
But if you try the sample project in attachment, i should get 2 records but it tells me ZERO.
How can i fix this?
Thanks for your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You're welcome.
BTW, there is a new "Priority" option that you can set when ask a question. It's not a big deal but since you left it at ,or chose, "Low" priority I was awarded less points for the solution than I would have gotten previously.
ASKER
Ok i will look at the priority option for the next time. Thanks
ASKER