ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print Button (https://www.excelbanter.com/excel-programming/339490-print-button.html)

Optitron

Print Button
 

I have rows of data on sheet2 that are put into sheet1 with the belo
program. What can I put in to enable me to select all the rows an
click the button to print a sheet1 for each row. Basically lik
printing an entire workbook with only 2 sheets and a button.

Option Explicit
Sub Cranial()
Dim prtWks As Worksheet
Dim actWks As Worksheet
Dim myRng As Range
Dim myCell As Range
Dim iRow As Long

Set actWks = ActiveSheet
Set prtWks = Worksheets("Sheet1")

Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))

With prtWks
For Each myCell In myRng.Cells
iRow = myCell.Row
.Range("E7").Value = actWks.Cells(iRow, "A").Value
.Range("H7").Value = actWks.Cells(iRow, "B").Value
.Range("AY3").Value = actWks.Cells(iRow, "A").Value
.Range("BB3").Value = actWks.Cells(iRow, "B").Value
.Range("AC5").Value = actWks.Cells(iRow, "C").Value
.Range("AK5").Value = actWks.Cells(iRow, "D").Value
.Range("AM5").Value = actWks.Cells(iRow, "E").Value
Application.Calculate
Next myCel

--
Optitro
-----------------------------------------------------------------------
Optitron's Profile: http://www.excelforum.com/member.php...fo&userid=2672
View this thread: http://www.excelforum.com/showthread.php?threadid=46588


Optitron[_2_]

Print Button
 

I found the answer. I put in Sheet1.PrintOut. I don't know how to delet
the thread...or should I just leave it

--
Optitro
-----------------------------------------------------------------------
Optitron's Profile: http://www.excelforum.com/member.php...fo&userid=2672
View this thread: http://www.excelforum.com/showthread.php?threadid=46588


Dave Peterson

Print Button
 
Just leave it.

People will see your reply and know you have a solution.

Optitron wrote:

I found the answer. I put in Sheet1.PrintOut. I don't know how to delete
the thread...or should I just leave it.

--
Optitron
------------------------------------------------------------------------
Optitron's Profile: http://www.excelforum.com/member.php...o&userid=26729
View this thread: http://www.excelforum.com/showthread...hreadid=465881


--

Dave Peterson


All times are GMT +1. The time now is 02:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com