Printing data sets

Lera

New Member
Joined
Nov 4, 2011
Messages
3
I have a multi-sheet workbook where the first two sheets are forms that get printed. I've set up text boxes in the appropriate places on those to pull data from one of the other sheets.

I have a third sheet where all my data is, in columns. Column A is last name, Column B is first name, and so on. Then I have a cell where I type in the row number for the data I want in the form. It all works, as long as I change that number each time I print.

What I'd like to do, if it's possible, is to specify beginning and ending rows, and then tell it to loop through them and print each one. Can that be done?
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
You can give this a spin...

Code:
Sub BulkPrint()
Dim wb As Workbook
Dim ws1, ws2, ws3 As Worksheet
Dim Cell As Range
Set wb = ThisWorkbook
'Update to appropriate sheet names
Set ws1 = Sheets("Sheet1")
Set ws2 = Sheets("Sheet2")
Set ws3 = Sheets("Sheet3")

Set Cell = ws3.Range("I1") '<UPDATE p update you sheet+cell the to manually<> StartRow = InputBox("On what row shall we start?", "STARTING ROW")
EndRow = InputBox("On what row shall we end?", "ENDING ROW")
For RowNum = StartRow To EndRow
    Cell.Worksheet.Activate
    Cell.Value = RowNum
    wb.Sheets(1).Calculate
    wb.Sheets(2).Calculate
    wb.Sheets(1).PrintOut
    wb.Sheets(2).PrintOut
Next RowNum
MsgBox "Done"
End Sub
 
Upvote 0

Forum statistics

Threads
1,226,220
Messages
6,189,697
Members
453,565
Latest member
Mukundan

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