[Excel VBA] Getting values for VBA array from spreadsheet range
Hi, I have some code I am looking at, and it currently assigns values to a VBA array as a block from a range in the spreadsheet by doing:
Code:
Dim DataArray As Variant
Workbooks("whatever.xlsm").Activate
Sheets("Sheet1").Select
DataArray = Range("A2:EV1000").Value
I want to do this same thing without selecting. I tried
Code:
DataArray = Workbooks("whatever.xlsm").Sheets("Sheet1").Range("A2:EV1000").Value
but that gave an error. What should I do? Thanks for any help!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
UPDATE: Apparently, the code above does work. But, the code I actually used was Windows("whatever.xlsm")... I had never seen Windows used before but it was in code I was updating a bit. So, my new question is:
What's the different between Windows and Workbooks? Are they mostly the same? Why does Windows not work above, but Workbooks does?
Thanks
Re: [Excel VBA] Getting values for VBA array from spreadsheet range
a workbook can be opened in multiple windows, using split or new window, some or all of which may not be visible