[英]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.