Function ConvertDate(r As Range) As String
Dim d As String
d = Mid(r,5,2) & "/2019"
Select Case Mid(r,4,1)
Case "C"
ConvertDate = "1/" & d
Case "D"
ConvertDate = "2/" & d
End Select
End Function
Sub test()
Dim FR As Long
FR = Range("B" & Rows.Count).End(xlUp).row
Range("A1:A" & FR).Formula ="=ConvertDate(H1)"
End sub
要解决此错误,我需要更改什么?