In the last weeks, I have noted that one of my answers in StackOverflow has received some upvotes. Which was somehow strange, as people keep on telling me that #VBA is going to die and it is a “funny scripting language” since 2012. Well, the fact that someone out there is hitting standard queries and researching standard VBA issues, has motivated me to make this YouTube video and article.
This is the code from the video:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
Option Explicit Sub TestMe() Dim myArr2D, myArr1Row, myArr1Col As Variant Dim myRange2D As Range, myRange1Row As Range, myRange1Col As Range Set myRange2D = ThisWorkbook.Worksheets("Sheet1").Range("A1:C20") Set myRange1Row = ThisWorkbook.Worksheets("Sheet1").Range("A1:C1") Set myRange1Col = ThisWorkbook.Worksheets("Sheet1").Range("A1:A20") myArr2D = myRange2D myArr1Row = Application.Transpose(Application.Transpose(myRange1Row)) myArr1Col = Application.Transpose(myRange1Col) Stop End Sub |
Enjoy it!