返回列表 上一主題 發帖

[發問] 資料轉置求助前輩

Sub 轉置()
Dim Arr, Brr, C%(2), r%, i&, j%
ActiveSheet.UsedRange.Offset(, 7).EntireColumn.Delete
Arr = Range([a3], [c65536].End(3))
ReDim Brr(1 To 8, 1 To 200)
For i = 2 To UBound(Arr)
    r = IIf(Arr(i, 1) > 6, 1, 0):  C(r) = C(r) + 1
    For j = 1 To 3
        Brr(r * 4 + j, C(r)) = Arr(i, j)
    Next j
    If C(r) > C(2) Then C(2) = C(r)
Next i
With [h2].Resize(UBound(Brr), C(2))
     .Value = Brr
     .Borders.LineStyle = 1
     .ColumnWidth = 4
     .Font.Size = 14
End With
End Sub

Xl0000541.rar (13.97 KB)


================================

TOP

        靜思自在 : 修行要繫緣修心,藉事練心,隨處養心。
返回列表 上一主題