Private Sub tCalc()
Dim colMax As Integer
Dim srcData()
Dim sumObj As String
Dim i As Integer, j As Integer, tNum As Integer
colMax = Range("IV1").End(xlToLeft).Column
srcData = Range(Cells(1, 1), Cells(20, colMax + 1)).Value '20为预设值
sumObj = ""
tNum = 0
For j = 1 To colMax Step 2 'j为列
i = 2 'i为行
Do While srcData(i, j) <> ""
sumObj = sumObj & "," & srcData(1, j) & "," & srcData(i, j) & "," & srcData(i, j + 1)
tNum = tNum + 1
i = i + 1
Loop
Next j
For i = 1 To tNum
Range("A" & 50 + i) = Split(sumObj, ",")(i * 3 - 2)
Range("B" & 50 + i) = Split(sumObj, ",")(i * 3 - 1)
Range("C" & 50 + i) = Split(sumObj, ",")(i * 3)
Next i
End Sub
【 在 Caps (天也不懂情) 的大作中提到: 】
: 好多年没有系统用excel,好多东西都忘记了,附件已经上传
--
FROM 114.255.78.*