我感兴趣的是,为什么,为什么下面一行("Sheets("Euro_usd").Columns("A").End(xlDown).Offset(1, 0).Value = EURO_USD.t_date")
导致应用程序在范围属性过程中定义了错误,是什么导致错误?
“应用程序定义或对象定义的错误”
用等价更换代码:Sheets("Euro_USD").Cells(rows.Count, "A").End(xlUp).Offset(1, 0).Value = EURO_USD.t_date
使得以dissapear错误。
为什么错误出现?它是否必须做的是为column属性的结束(xldown)已经在堆栈中占用(不确定的术语),并因此新的请求产生错误?
Private Sub run() ' run the whole operation
Dim HTTP_Req As Object: Set HTTP_Req = New HTTP_Req
Dim EURO_USD As Object: Set EURO_USD = New EURO_USD
If Sheets("EURO_USD").Columns("A").End(xlDown).Value = DateValue(EURO_USD.t_date) Then
Debug.Print "Date already exist"
Else
Sheets("Euro_usd").Columns("A").End(xlDown).Offset(1, 0).Value = EURO_USD.t_date <-- Error here!
End If
End Sub
查找最后一行然后添加值。你可能想看看[这](http://stackoverflow.com/questions/11169445/error-finding-last-used-cell-in-vba)另外要检查一个日期是否在一列中,你可以使用'Application.WorksheetFunction.CountIf()' – 2014-10-02 00:30:54