Let’s say I have a row of cells, which have the following values:
B2: "banana" C2: "orange" D2: "apple"
I take this range and turn it into 2-dimensional array (My main code is in Word document):
dim MySheet as Excel.Worksheet dim arr as variant Set MySheet = Excel.Sheets(1) arr = MySheet.Range(MySheet.Cells(2, 2), MySheet.Cells(2, 4))
I have a combobox
CbbFruits and I don’t want to add the items one by one, so I use the
CbbFruits.List = arr
banana entry is added. As I understand for this method to work correctly the array and therefore the range of cells have to be positioned vertically. But what can I do if I don’t want to reshuffle my cells? Is there a method to switch axises of an array in VBA or something?