复制Sheet1范围在Sheet2上向下粘贴八行

时间:2019-04-02 18:30:59

标签: excel vba

我的脚本复制并从sheet1粘贴。我该如何在下一个第二页的脚本中设置工作数据,即Sheet2中向下的“ 8”行?

Sub Macro()

    Sheets("Sheet1").Select
    Cells.Select
    Selection.Copy
    Sheets("Sheet2").Select
    Cells.Select
    ActiveSheet.Paste
    Range("A1").Select
    Cells.Select
    Cells.EntireColumn.AutoFit
    Range("A1").Select
    Columns("F:F").ColumnWidth = 10


 For Each ws In Sheets
 On Error Resume Next
 For Each r In ws.UsedRange.SpecialCells(xlCellTypeConstants)
 If IsNumeric(r) Then r.Value = Val(r.Value)
 Next
 Next

    Sheets("Sheet1").Select
    Range("A18:A50").Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("B122").Select
    ActiveSheet.Paste
    Range("B122").Select
    Application.CutCopyMode = False

    Sheets("Sheet1").Select
    Range("B18:B50").Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("A122").Select
    ActiveSheet.Paste
    Range("A122").Select
    Application.CutCopyMode = False

     Sheets("Sheet1").Select
    Range("J18:J50").Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("C122").Select
    ActiveSheet.Paste
    Range("C122").Select
    Application.CutCopyMode = False

       Sheets("Sheet1").Select
    Range("R18:R50").Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("D122").Select
    ActiveSheet.Paste
    Range("D122").Select
    Application.CutCopyMode = False

      Range("C122:C200").Select
    With Selection
        .HorizontalAlignment = xlRight
        .VerticalAlignment = xlTop
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With

End Sub

0 个答案:

没有答案