Step 1: Define a sub-procedure to store a macro. After transposing, it would be an array with two rows and six columns.įollow the below steps to use Transpose in VBA. This is a two-dimensional data with six rows and two columns. Suppose you have a two-dimensional array of employees and their salaries as below: Example #2 – VBA Transpose of two-dimensional Array You can see that the given array of the list is transposed into one single column and stored under cell A1 to A5.
Step 6: Hit F5 or Run button under VBE to run this code and see the output under active excel spreadsheet. Here, we have defined a code which will allow the system to transpose the data in list array called Arr1 and then store it under cell A1:A5 on the active worksheet. Step 5: Use on the given array to be able to transpose the list defined under Arr1 variable. Step 4: Now use the Range.Value method to define the range in which these values you wanted to get pasted. This would be the list you wanted to paste in your excel sheet.Īrr1 = Array('Lalit', 'Sneha', 'Ethyl', 'John', 'Cory') Step 3: Define the list as an array using the Array function. Step 2: Define a new variable which can hold your one-dimensional array.