Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print group of sheets by VBA
Hello, I am trying to select several sheets that correspond to some criteria in the VBA code, to print them all in once afterwards. This works if I put their name but I cannot solve when the names are in an array
1) that code work arrayGuide = Array("sheet1", "sheet2", "sheet3 Sheets(arrayGuide).Selec ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=Tru 2) I would like to have the same by taking the name of the sheets to select from a table. I've tried so many things that it would not be useful to paste my last finding here ;- Thanks a lot for your time and help ! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print group of sheets by VBA
Try:
arrayGuide = Array("sheet1", "sheet2", "sheet3) For x = LBound(arrayGuide) To UBound(arrayGuide) Sheets(arrayGuide(x)).PrintOut Copies:=1, Preview:=True Next x I haven't tested this, but it works in theory. - Piku -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print group of sheets by VBA
Sub AATester4()
Dim bFirst As Boolean bFirst = True For Each sh In ThisWorkbook.Worksheets If sh.Range("A1") = 1 Then sh.Select bFirst bFirst = False End If Next End Sub Change if sh.Range("A1") = 1 then to use your criteria for selecting sheets. -- Regards, Tom Ogilvy "kyoux" wrote in message ... Hello, I am trying to select several sheets that correspond to some criteria in the VBA code, to print them all in once afterwards. This works if I put their name but I cannot solve when the names are in an array. 1) that code works arrayGuide = Array("sheet1", "sheet2", "sheet3) Sheets(arrayGuide).Select ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True 2) I would like to have the same by taking the name of the sheets to select from a table. I've tried so many things that it would not be useful to paste my last finding here ;-) Thanks a lot for your time and help ! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print group of sheets by VBA
GREAT,
I've adapted it and it works perfectly Thanks a lot Tom |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Name a group of sheets | Excel Discussion (Misc queries) | |||
sort between a group of sheets | Excel Worksheet Functions | |||
How do I print sheets in Excel without blank sheets after page | New Users to Excel | |||
group cells so they always print together | Excel Discussion (Misc queries) | |||
Group Sheets | Excel Discussion (Misc queries) |