简体   繁体   English

将单元格从一张纸复制到另一张纸,对范围内的所有单元格重复

[英]Copy cell from one sheet to another, repeat for all cells within range

I need to repeat the code below for cells in the range A2 to A46 that contain values.我需要为 A2 到 A46 范围内包含值的单元格重复以下代码。

Worksheets("Full Qual").Range("A2").Copy _
  Destination:=Worksheets("Test").Range("D4")
ActiveWorkbook.PrintOut From:=2, To:=4, Copies:=1, Collate:=True, _
    IgnorePrintAreas:=False

The goal is to copy the cell from worksheet "Full Qual" to worksheet "Test", print it, then move on to the next cell below and repeat for all cells with values up to cell A46.目标是将单元格从工作表“Full Qual”复制到工作表“Test”,打印它,然后移动到下面的下一个单元格并重复所有单元格的值直到单元格 A46。

Consider:考虑:

Dim N As Long, v As Range
For N = 2 To 46
    Set v = Worksheets("Full Qual").Range("A" & N)
    If v.Value <> "" Then
        Worksheets("Full Qual").Range("A" & N).Copy _
          Destination:=Worksheets("Test").Range("D4")
        ActiveWorkbook.PrintOut From:=2, to:=4, Copies:=1, Collate:=True, _
            IgnorePrintAreas:=False
    End If
Next N

UNTESTED未经测试

暂无
暂无

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

相关问题 将单元格范围从一张纸复制到另一张纸 - Copy range of cells from one sheet to another 如何在一张纸到另一张纸中的特定单元格的范围内复制单元格数据? - How do you copy cell data in a range from one sheet to specific cells in another sheet? Macro Excel可根据单元格匹配将范围单元格从一张纸复制到另一张纸,如果不匹配,则跳过单元格 - Macro Excel to copy range cells from one sheet to another based on cell match and skip cell if no match 根据另一个单元格中的条件将单元格从一个工作表复制到另一个工作表 - Copy cells from one sheet to another based on criteria in another cell 从一个工作表复制单元格并粘贴到另一个工作表中到可变单元格 - Copy cells from one sheet and paste in another to a variable cell 如何根据单元格值将行内的范围从一个 Excel 工作表复制到另一个 - How to copy a range within a row from one excel sheet to another based on a cell value 从另一张纸上的单元格值复制同一张纸中范围的一部分的粘贴范围 - Copy Range From One Sheet Paste Part of Range In Same Sheet Based On Cell Value On Another Sheet 将所有突出显示的单元格从一张纸复制到另一张纸 - Copy all highlighted cells from one sheet to another 根据单元格colorindex从一个工作表的粘贴范围复制范围到另一工作表的另一工作表 - Copy Range From One Sheet Paste Part of Range In another Sheet Based On Cell colorindex 从一张纸到另一张纸复制并粘贴一系列单元格,然后清除原始单元格中的数据 - Copy and paste a range of cells from one sheet to another then clear data from orignal cells
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM