ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Do Until Loop Question, for Printing (https://www.excelbanter.com/excel-programming/357723-do-until-loop-question-printing.html)

Renee

Do Until Loop Question, for Printing
 
Good afternoon all,

I have a list of names on a worksheet named Lists. On the Main
worksheet, I have a drop down field that references the range of names
(called Names).

If anyone can please help me with the code to automatically:
1. In the drop down, select the first name (B1)
(This generates a report on the Main worksheet in A2:J20)
2. Print the Main worksheet
3. Select the next name
4. Print the Main worksheet
...repeat until there are no more names (i.e. blank cell in column A on the
Lists Worksheet)

Thank you, and have a great weekend!
Renee

Tom Ogilvy

Do Until Loop Question, for Printing
 
You said the range is named Lists, then I think you said it is named Names.
C11 below represents where the dropdown places the selection. Change to
suit.

Sub ABC()
Dim cell as Range
for each cell in Range("Lists")
Worksheets("Sheet1").Range("C11").Value = cell.Value
worksheets("Main").Range("A2:J20").Printout
Next
End Sub

--
Regards,
Tom Ogilvy





"Renee" wrote:

Good afternoon all,

I have a list of names on a worksheet named Lists. On the Main
worksheet, I have a drop down field that references the range of names
(called Names).

If anyone can please help me with the code to automatically:
1. In the drop down, select the first name (B1)
(This generates a report on the Main worksheet in A2:J20)
2. Print the Main worksheet
3. Select the next name
4. Print the Main worksheet
..repeat until there are no more names (i.e. blank cell in column A on the
Lists Worksheet)

Thank you, and have a great weekend!
Renee



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

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