How store a range from excel into a Range variable?

后端 未结 5 1430
时光说笑
时光说笑 2021-01-04 12:15

I am reading some cells of excel using VBA.

Function getData(currentWorksheet as Worksheet, dataStartRow as Integer, _
dataEndRow as Integer, DataStartCol as         


        
5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-04 12:58

    What is currentWorksheet? It works if you use the built-in ActiveSheet.

    dataStartRow=1
    dataStartCol=1
    dataEndRow=4
    dataEndCol=4
    Set currentWorksheet=ActiveSheet
    dataTable = currentWorksheet.Range(currentWorksheet.Cells(dataStartRow, dataStartCol), currentWorksheet.Cells(dataEndRow, dataEndCol))
    

提交回复
热议问题