
12-25-2020, 01:04 PM
|
 |
Expert
|
|
Join Date: May 2013
Location: USA
Posts: 700
|
|
Never mind; I tried a number of different combinations before posting, but stumbled across the correct one only afterward. The secret in VBS is not to declare the array. In VBScript, arrays have zero as the bottom boundary in all dimensions; apparently it then complains when I try to load ranges from Excel into such an array.
But when I don't declare ar at all, it works correctly, and furthermore the LBOUND in both dimensions is 1, not 0:
Code:
' owb is the workbook
set owsSet=owb.worksheets("Settings")
rZ=LastRow(owsSet,1,1)
ar=oxl.range(owsSet.cells(2,1),owsSet.cells(rz,2)).Value
msgbox lbound(ar,1) & "-" &ubound(ar,1) & " x " & lbound(ar,2) & "-" & ubound(ar,2)
This displays "1-28 x 1-2".
|