CodePudding user response:
Effect:Add the following procedure code to Sheet1 code form, press F5 to run:
Sub ColToRow ()
Dim x As Integer
X=8 'table 2 column
Dim y As Integer
The beginning of the line y=1 'table 2
Dim As Integer I
For I=2 To 4 'data in table 1 To start and end row
Dim j As Integer
J=2 'data start line of the table 1
While Cells (j, I) & lt;> "
"'start transformation, converts the contents of table 1 to table 8.
'the three columns of data:
Cells (y, x)=Cells (1, I) 'the first x listed in table 2 in the first row data set to table 1 y of line 1 in the first column data. I
Cells (y, x + 1)=Cells (j, 1) 'the first x + 1 table 2 listed the first line y data set to the first line j column 1 data in table 1.
Cells (y, x + 2)=Cells (j, I) 'table 2 x + 2 column in the first row data set to table 1 y of the ith line j column data.
J=j + 1 'data row j down in table 1.
Y=y + 1 'data line of the table 2 y down.
Wend
Next
End Sub
Download address:
Link: https://pan.baidu.com/s/1UntqZb2jb2cIMOOCRoFCjg
The extracted code: bdil