excel 怎样用vba实现多行身份证号码提取出生日期
发布网友
发布时间:2022-04-22 23:05
我来回答
共1个回答
热心网友
时间:2023-10-08 16:08
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Dim i As Long
If Target.Column = 3 Then
For i = Target.Row To Target.Row + Target.Rows.Count - 1
Range("D" & i) = Mid(Range("C" & i), 7, 8)
If Mid(Range("C" & i), 17, 1) Mod 2 = 0 Then Range("E" & i) = "女" Else Range("E" & i) = "男"
Next
End If
End Sub以上只适用18位身份证,15位的自己发挥一下