muhleebbin
Active Member
- Joined
- Sep 30, 2017
- Messages
- 252
- Office Version
- 365
- 2019
- 2016
- 2013
- 2010
- Platform
- Windows
- MacOS
- Mobile
- Web
Thank you in advance with your assistance on this!
I have the following partially functioning macro, however it prints off unnecessary pages beyond the data filled in column T. Is there a way to designate the "r" to finish at the same point as the "Lastrow"? Also is there a 'cleaner' way to code this?
Dim Lastrow As Integer
Lastrow = Sheet12.Range("AA4")
Sheet12.Range("T2").Select
Selection.AutoFill Destination:=Range("T2:T" & Lastrow)
Sheet12.Range("U2").Select
Selection.AutoFill Destination:=Range("U2:U" & Lastrow)
Sheet12.Range("Y2").Select
Selection.AutoFill Destination:=Range("Y2:Y" & Lastrow)
Dim r As Long
For r = 2 To Sheet12.Cells(Sheet11.Rows.Count, "T").End(xlUp).Row Step 2
Sheet12.Range("D13:H14").Value = Sheet12.Cells(r, "T").Value
Sheet12.Range("D38:H39").Value = Sheet12.Cells(r + 1, "T").Value
Sheet12.PrintOut
Next r
End Sub
I have the following partially functioning macro, however it prints off unnecessary pages beyond the data filled in column T. Is there a way to designate the "r" to finish at the same point as the "Lastrow"? Also is there a 'cleaner' way to code this?
Dim Lastrow As Integer
Lastrow = Sheet12.Range("AA4")
Sheet12.Range("T2").Select
Selection.AutoFill Destination:=Range("T2:T" & Lastrow)
Sheet12.Range("U2").Select
Selection.AutoFill Destination:=Range("U2:U" & Lastrow)
Sheet12.Range("Y2").Select
Selection.AutoFill Destination:=Range("Y2:Y" & Lastrow)
Dim r As Long
For r = 2 To Sheet12.Cells(Sheet11.Rows.Count, "T").End(xlUp).Row Step 2
Sheet12.Range("D13:H14").Value = Sheet12.Cells(r, "T").Value
Sheet12.Range("D38:H39").Value = Sheet12.Cells(r + 1, "T").Value
Sheet12.PrintOut
Next r
End Sub