我得到一个#Name吗?运行宏时出错

时间:2019-07-30 20:50:57

标签: excel vba

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

要解决此错误,我需要更改什么?

0 个答案:

没有答案