您能否帮我解决Excel VBA文件中的问题?得到错误Runtime Error '438' "Object doesn't support this propert or method"
错误发生在以下行:Worksheets("Sheet1").Label2.Caption = DateValue(Now)
Sub auto_open()
' Call Worksheets(1).Label1
Dim i As Integer
Dim lists() As String
Worksheets("Sheet1").Label2.Caption = DateValue(Now)
Worksheets("Sheet1").ComboBox1.ListFillRange = "XFB2:XFB8"
Worksheets("Sheet1").ComboBox2.ListFillRange = "XFC2:XFC4"
Worksheets("Sheet1").ComboBox3.ListFillRange = "XFD2:XFD14"
End Sub
答案 0 :(得分:0)
您无法像标签那样引用标签,因为标签只是标签集合中的一个项目。
您可以通过以下ID引用它:
Worksheets("Sheet1").Labels(1)
或者像这样的名字
Worksheets("Sheet1").Labels("Label 2")