【发布时间】:2018-04-16 20:08:16
【问题描述】:
我有以下 sn-p VBA:
DatetoRun = InputBox("How far back do you want to run the MI for?", "Date backing", Format(Now(), "dd/mm/yyyy"))
'Date validation for DatetoRun
If IsDate(DatetoRun) Then
DatetoRun = Format(CDate(DatetoRun), "dd/mm/yyyy")
dateStart = DatetoRun
Else
MsgBox "Please enter a DATE in the correct format dd/mm/yyyy"
End If
Set found = Range("A:A").Find(what:=DatetoRun, LookIn:=xlValues, lookat:=xlWhole)
iclearrow = found.Row
当执行它时,我不断得到 p>
对象变量或With Block变量未设置
这让我在设置它时感到困惑:
Set found = Range("A:A").Find(what:=DatetoRun, LookIn:=xlValues, lookat:=xlWhole)
错误发生在最后一行:
iclearrow = found.Row
不确定这是如何发生或为什么发生的。有时它也会随机工作一次,但之后会出错。没有什么是一致的!
【问题讨论】:
标签: vba excel runtime-error