我正在尝试执行这种转换。为了说明起见,我将其列为表格,因此基本上应该重复前三列以提供多少种可用颜色。
我搜索了其他类似的种类,但是当我想重复多列时找不到。我在网上找到了此代码,但是它是Name Thank Location Thank Location Thank Location Thank Location Thank Location,并使其如下所示。Name Thank Location
Sub createData()
Dim dSht As Worksheet
Dim sSht As Worksheet
Dim colCount As Long
Dim endRow As Long
Dim endRow2 As Long
Set dSht = Sheets("Sheet1") 'Where the data sits
Set sSht = Sheets("Sheet2") 'Where the transposed data goes
sSht.Range("A2:C60000").ClearContents
colCount = dSht.Range("A1").End(xlToRight).Column
'// loops through all the columns extracting data where "Thank" isn't blank
For i = 2 To colCount Step 2
endRow = dSht.Cells(1, i).End(xlDown).Row
For j = 2 To endRow
If dSht.Cells(j, i) <> "" Then
endRow2 = sSht.Range("A50000").End(xlUp).Row + 1
sSht.Range("A" & endRow2) = dSht.Range("A" & j)
sSht.Range("B" & endRow2) = dSht.Cells(j, i)
sSht.Range("C" & endRow2) = dSht.Cells(j, i).Offset(0, 1)
End If
Next j
Next i
End Sub
可以帮我更改我想要的格式吗,我尝试将步骤2更改为1,将j从4更改为开始,但这无济于事。例如,有2套不同的套:2套不同
慕森卡
慕勒3428872