简体   繁体   English

将不同工作表中相同的非连续单元格复制并粘贴到母版纸上

[英]copy and paste same non contiguous cells from different sheets to master sheet

how to copy same non contiguous cell from different sheets and paste in one master sheets ("sheet5") row by row. 如何从不同的工作表中复制相同的非连续单元格并逐行粘贴到一个主工作表(“sheet5”)中。

Sub test()

    Dim cel As Range, pasteRange As Range

    Set pasteRange = ThisWorkbook.Sheets("Sheet5").Range("A2")

    For i=1 to 4
        For Each cel In ThisWorkbook.Sheets(i).Range("A2, B4, D5, E1, F3")
            pasteRange.Value = cel.Value
            Set pasteRange = pasteRange.Offset(0, 1)
        Next
    Next

End Sub
Dim cel As Range, pasteRange As Range
Dim sht As Worksheet

' Do not use 'ThisWorkbook' - what is the macro us ran from another one?
' Use 'ActiveWorkbook' instead or specify its name
Set pasteRange = ActiveWorkbook.Sheets("Sheet5").Range("A2")

'
For Each sht In Sheets
    If sht.name <> "Sheet5" Then
        For Each cel In sht.Range("A2, B4, D5, E1, F3")
            pasteRange.Value = cel.Value
            Set pasteRange = pasteRange.Offset(0, 1)
        Next
    End If
Next

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从多个工作表中复制相同单元格地址的相同非连续数据,并粘贴到一个主工作表中 - Copy same non contiguous data at same cell address from multiple worksheets and paste in one master worksheet 复制同一行中不同列的单元格,并粘贴到另一个工作表上同一行的不同列 - Copy cells from different columns on same row, and paste to different columns on same row on another sheet 根据条件在不同的工作表中复制/粘贴从非连续列到非连续列的一系列数据 - copy/paste a range of data from non contiguous to non-contiguous columns in a different worksheet based on condition 从子文件夹excel文件中复制来自非连续单元格(A1,B5,C6)的数据并粘贴到父文件夹中找到的主文件中 - copy data from non contiguous cells (A1, B5, C6) from subfolders excel files and paste in master file found in parent folder 从不同的工作表中复制值并将其粘贴到主文件中 - Copy values from different sheets and paste it in a master file Excel 2007-将来自多个工作表的非连续数据合并到一个主工作表(即预算工作簿)中 - Excel 2007 - Consolidating non contiguous data from multiple sheets into a master sheet (ie a budget workbook) 需要从几张不同的纸上垂直复制并粘贴到一张纸上 - Need to copy & paste from several different sheets into one sheet vertically 使用 VBA 从两个不同的工作表复制粘贴单元格 - Copy paste cells using VBA from two different sheets 从非连续单元格复制数据 - Copy data from non-contiguous cells 如何将不连续的单元格从一个工作簿复制到另一个工作簿中的另一组不连续的单元格? - How can I copy non-contiguous cells from a workbook to a different set of non-contiguous cells in another workbook?
相关标签
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM