VBA编译错误:“Sub或Function not defined”

时间:2017-12-02 07:24:04

标签: excel-vba vba excel

以下是我的代码,我在运行时收到编译错误。请帮我解决。

Private Sub CommandButton1_Click()
    Dim yourname As String
    Dim yourbirthday As Date
    Dim yourincome As Currency
    your Name = "Rahul"
    yourbirthday = "26/03/1996"
    yourincome = "100000"
    Range("A1") = yourname
    Range("A2") = yourbirthday
    Range("A3") = yourincome
End Sub

2 个答案:

答案 0 :(得分:0)

“你的”和“姓名”之间有一个空格:

your Name = "Rahul"

答案 1 :(得分:0)

您的代码:

your Name = "Rahul"

应该是:

yourname = "Rahul"