需要帮助将宏从绘图信息从多个工作簿更改为行而不是列

时间:2018-05-11 14:14:58

标签: excel vba excel-vba

非常感谢任何人将更改以下代码的帮助从不同电子表格中的信息绘制到行而不是列中。

目前它将把信息绘制到B1:E3中为表1然后F1:I3表示第2页等。

我需要它将信息绘制成行而不是表1 B1:F3然后表2 B4:F6

Sub Get_Columns()
Dim sPath As String
Dim sFil As String
Dim owb As Workbook
Dim twb As Workbook

With Application
    .Calculation = xlCalculationManual
    .EnableEvents = False
    .ScreenUpdating = False
End With

Set twb = ThisWorkbook
sPath = ThisWorkbook.Path & "\"
sFil = Dir(sPath & "*.xl*")

Do While sFil <> "" And sFil <> twb.Name
    Set owb = Workbooks.Open(sPath & sFil)
    owb.Sheets("Foot").Range("C15:F17").Copy twb.Sheets("Ball").Cells(, Columns.Count).End(xlToLeft).Offset(, 1)
    owb.Close False
    sFil = Dir
Loop

    With Application
    .Calculation = xlAutomatic
    .EnableEvents = True
    .ScreenUpdating = True
End With
End Sub

0 个答案:

没有答案