Function 万能转日期(a As Range)
If a <> "" Then
B = "R" & a
For I = Len(B) To 1 Step -1
If IsNumeric(Mid(B, I, 1)) Then
F = Mid(B, I, 1) & F
Else
G = Format(F, "00") & G
F = ""
End If
Next
If Len(G) = 4 Then G = Year(Now()) & G
If Len(G) = 6 Then
If Left(G, 2) * 1 > Mid(Year(Now()), 3, 2) * 1 Then
G = "19" & G
Else
G = "20" & G
End If
End If
G = Right(G, 8)
If IsDate(Format(G, "0000-00-00")) Then
万能转日期 = Format(G, "0000-00-00")
Else
万能转日期 = "日期不合法,源文本有错误"
End If
End If
End Function
Access软件网交流QQ群(群号:198465573) |