|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。
- Sub ykcbf() '//2024.12.21
- r = Cells(Rows.Count, 1).End(3).Row
- arr = [a1].Resize(r, 2)
- On Error Resume Next
- For i = 2 To UBound(arr)
- If IsDate(arr(i, 1)) = True Then
- arr(i, 2) = arr(i, 1)
- Else
- st = CStr(arr(i, 1))
- If InStr(st, "-") = 0 Then
- If InStr(st, "日") = 0 Then rq = st & "日" Else rq = st
- arr(i, 2) = CDate(rq)
- Else
- st = Split(st, "-")
- If InStr(st(1), "月") = 0 Then
- rq = Left(st(0), InStr(st(0), "月")) & st(1)
- arr(i, 2) = CDate(rq)
- Else
- arr(i, 2) = CDate(st(1))
- End If
- End If
- End If
- Next
- [a1].Resize(r, 2) = arr
- End Sub
复制代码
|
|