Print row and delete row to finish the printed rows pending

marreco

Well-known Member
Joined
Jan 1, 2011
Messages
609
Office Version
  1. 2010
Platform
  1. Windows
Hi.
a friend called arlu1201 help me make this macro.
When you run the macro, it would copy the selected rows to the worksheet "Result_Print" as doing this, and it would trigger the printing of the first row, exclude the first line,
By excluding the first-line second would be the first shot and then a new print and so on to print all lines.


Code:
Option Explicit


Sub copy_print()
Dim i As Long, lrow As Long


With Worksheets("Base")
    lrow = .Range("B" & .Rows.Count).End(xlUp).Row
    For i = 2 To lrow
        If .Range("A" & i).Value = "x" Then
            .Range("B" & i & ":F" & i).Copy Worksheets("Result_Print").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
        End If
    Next i
End With


End Sub
Thank you!!!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,203,071
Messages
6,053,375
Members
444,658
Latest member
lhollingsworth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top