select案例,根据查找文本

我想每15分钟更新一次新的数据表。 我正在寻找的代码是这样的:

案件数据不存在表单“做某事”的情况下,其他“别的东西”

我写的代码是:

Dim LastRow1 As Long With Sheets("Stocks") LastRow1 = .Cells(.rows.count, "A").End(xlUp).row End With Dim e As String Dim Cell As Range Dim rRng As Range Dim find As Range Dim stock as string Set rRng = Sheets("results").Range("D2:F" & LastRow1) For Each Cell In rRng If Cell.Value >= (-0.01) And Cell.Value <= 0.01 Then stock = Sheets("results").Cells(Cell.row, 1) Set find = Sheets("Signal").Columns(1).find(what:=stock, MatchCase:=True, Lookat:=xlWhole) Select Case find '> > > I have an error here, when find is nothing Case Is = "nothing" MsgBox "add new data" Case Else MsgBox "Update data" End Select 'copy new data End If 

错误编号是97 对象variables或未设置块variables

我相信你以后是

 If Cell.Value >= (-0.01) And Cell.Value <= 0.01 Then stock = Sheets("results").Cells(Cell.row, 1) Set find = Sheets("Signal").Columns(1).find(what:=stock, MatchCase:=True, Lookat:=xlWhole) If find Is Nothing Then MsgBox "add new data" Else MsgBox "Update data" End If End If