Private Sub val_date_exist_Click()
Dim strDate As String
Dim dt As Date
Dim I As Long
For I = 1 To MSHFlexGrid1.Rows - 1
strDate = Trim(MSHFlexGrid1.TextMatrix(I, 1))
dt = DateSerial(CInt(Mid(strDate, 1, 2)), CInt(Mid(strDate, 4, 2)), CInt(Mid(strDate, 7, 4)))
If strDate = Format(dt, "MM/DD/YYYY") Then
Else
MSHFlexGrid1.TextMatrix(I, 0) = MSHFlexGrid1.TextMatrix(I, 1) & " - " & "BAD DATE FORMAT"
End If
Next
'Auto column fit
Dim c As Long
Dim cell_wid As Single
Dim col_wid As Single
Dim z As Long
For c = 0 To MSHFlexGrid1.Cols - 1
col_wid = 0
For z = 0 To MSHFlexGrid1.Rows - 1
cell_wid = TextWidth(MSHFlexGrid1.TextMatrix(z, c))
If col_wid < cell_wid Then col_wid = cell_wid
Next z
MSHFlexGrid1.ColWidth(c) = col_wid + 120
Next c
End Sub
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.