Link to home
Start Free TrialLog in
Avatar of Wilder1626
Wilder1626Flag for Canada

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:
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

Open in new window


But if you try the sample project in attachment, i should get 2 records but it tells me ZERO.

How can i fix this?
User generated image
Thanks for your help.
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Wilder1626

ASKER

Thanks again for your help. It's working now.
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.
Ok i will look at the priority option for the next time. Thanks