ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do you Print with a loop? (https://www.excelbanter.com/excel-programming/331596-how-do-you-print-loop.html)

rohrl77

How do you Print with a loop?
 

I have a drop downlist (data validation) that changes my report data.
want to use a 'loop' to print the 15 odd reports automatically withou
having to click through each combination. Any help is appreciated
Thanks! :confused

--
rohrl7
-----------------------------------------------------------------------
rohrl77's Profile: http://www.excelforum.com/member.php...fo&userid=2424
View this thread: http://www.excelforum.com/showthread.php?threadid=37853


Jim Thomlinson[_4_]

How do you Print with a loop?
 
Here is some code for you. You will need to change a couple of things to make
it work. I have commented the code where it needs to be changed. For debug
purposes it is set to printpreview instead of print. Just change the
commenting of the Printout line...

Sub PrintList()
Dim wks As Worksheet
Dim rngDropDown As Range
Dim rngList As Range
Dim rngCurrent As Range

Set wks = Sheets("Sheet1") 'Change this
Set rngDropDown = wks.Range("A1") 'Change this
Set rngList = Range(rngDropDown.Validation.Formula1)

For Each rngCurrent In rngList
rngDropDown.Value = rngCurrent.Value
'wks.PrintOut
wks.PrintPreview
Next rngCurrent

End Sub
--
HTH...

Jim Thomlinson


"rohrl77" wrote:


I have a drop downlist (data validation) that changes my report data. I
want to use a 'loop' to print the 15 odd reports automatically without
having to click through each combination. Any help is appreciated.
Thanks! :confused:


--
rohrl77
------------------------------------------------------------------------
rohrl77's Profile: http://www.excelforum.com/member.php...o&userid=24248
View this thread: http://www.excelforum.com/showthread...hreadid=378538



Bernie Deitrick

How do you Print with a loop?
 
If your list is from a range or a named range, then you simply use code like

Dim myCell As Range
For Each myCell In Range("DataValidationListRange")
Range("CellwithDropdown").Value = myCell.Value
Application.CalculateFull
ActiveSheet.PrintOut
Next myCell


HTH,
Bernie
MS Excel MVP


"rohrl77" wrote in
message ...

I have a drop downlist (data validation) that changes my report data. I
want to use a 'loop' to print the 15 odd reports automatically without
having to click through each combination. Any help is appreciated.
Thanks! :confused:


--
rohrl77
------------------------------------------------------------------------
rohrl77's Profile:

http://www.excelforum.com/member.php...o&userid=24248
View this thread: http://www.excelforum.com/showthread...hreadid=378538




rohrl77[_2_]

How do you Print with a loop?
 

Bernie & Jim,

Thank you for your help! Both codes work well for my problem!
Cheers,
Luka

--
rohrl7
-----------------------------------------------------------------------
rohrl77's Profile: http://www.excelforum.com/member.php...fo&userid=2424
View this thread: http://www.excelforum.com/showthread.php?threadid=37853



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

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