选择案例,根据查找文字

时间:2017-01-22 03:13:35

标签: excel excel-vba find if-case vba

我想每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 对象变量或未设置块变量

1 个答案:

答案 0 :(得分:1)

我相信你所追求的是

public class model implement serializable {
    ****
}