Excel VBA Run Time Error '424' object required

后端 未结 4 766
不知归路
不知归路 2021-01-03 22:50

I am totally new in VBA and coding in general, am trying to get data from cells from the same workbook (get framework path ...) and then to start application (QTP) and run t

4条回答
  •  感动是毒
    2021-01-03 23:20

    You have two options,

    -If you want the value:

    Dim MyValue as Variant ' or string/date/long/...
    MyValue = ThisWorkbook.Sheets(1).Range("A1").Value
    

    -if you want the cell object:

    Dim oCell as Range  ' or object (but then you'll miss out on intellisense), and both can also contain more than one cell.
    Set oCell = ThisWorkbook.Sheets(1).Range("A1")
    

提交回复
热议问题