Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This one I just can not figure out.
In my workbooks I will have many sheets, the first sheet and the last sheet will always have the same name, "Master Sheet" and "Rev Record" respectivily. I have a macro that prints the workbook but I do not want to print the first and last worksheets. (The macro does much more than just print). I use "ActiveWorkbook.PrintOut", which priints everything. My stumbling block is, I do not know how many sheets will exist between the first and last sheets nor do I know how to NOT print the two sheets mentioned. If you understand this querry, raise your hand! ;) Thanks in advance! -- Regards VBA.Noob.Confused XP Pro Office 2007 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sub this for your current PrintOut.
x = ThisWorkbook.Sheets.Count For i = 2 to x - 1 Sheets(i).PrintOut Next "Rick S." wrote: This one I just can not figure out. In my workbooks I will have many sheets, the first sheet and the last sheet will always have the same name, "Master Sheet" and "Rev Record" respectivily. I have a macro that prints the workbook but I do not want to print the first and last worksheets. (The macro does much more than just print). I use "ActiveWorkbook.PrintOut", which priints everything. My stumbling block is, I do not know how many sheets will exist between the first and last sheets nor do I know how to NOT print the two sheets mentioned. If you understand this querry, raise your hand! ;) Thanks in advance! -- Regards VBA.Noob.Confused XP Pro Office 2007 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Of course, that code relies on "Master Sheet" always being the left most tab
and "Rev Record" always being the right most tab in the window view. It will otherwise fail to do what you want. "Rick S." wrote: This one I just can not figure out. In my workbooks I will have many sheets, the first sheet and the last sheet will always have the same name, "Master Sheet" and "Rev Record" respectivily. I have a macro that prints the workbook but I do not want to print the first and last worksheets. (The macro does much more than just print). I use "ActiveWorkbook.PrintOut", which priints everything. My stumbling block is, I do not know how many sheets will exist between the first and last sheets nor do I know how to NOT print the two sheets mentioned. If you understand this querry, raise your hand! ;) Thanks in advance! -- Regards VBA.Noob.Confused XP Pro Office 2007 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can also do it with an If ... Then statement:
For Each Sheet In ThisWorkbook If Sheet.Name < "Master Sheet" And Sheet.Name < "Rev Record" Then Sheet.PrintOut End If Next "Rick S." wrote: This one I just can not figure out. In my workbooks I will have many sheets, the first sheet and the last sheet will always have the same name, "Master Sheet" and "Rev Record" respectivily. I have a macro that prints the workbook but I do not want to print the first and last worksheets. (The macro does much more than just print). I use "ActiveWorkbook.PrintOut", which priints everything. My stumbling block is, I do not know how many sheets will exist between the first and last sheets nor do I know how to NOT print the two sheets mentioned. If you understand this querry, raise your hand! ;) Thanks in advance! -- Regards VBA.Noob.Confused XP Pro Office 2007 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This one will work! The sheets I stated will always be first and last.
Only had to make one minor change from your code: x = ActiveWorkbook.Sheets.Count Had to use ActiveWorkbook instead of ThisWorkbook, when using ThisWorkbook it would only count two sheets? Amazing, I simply did not think of iterating thru each sheet. Thanks!!! -- Regards VBA.Noob.Confused XP Pro Office 2007 "JLGWhiz" wrote: sub this for your current PrintOut. x = ThisWorkbook.Sheets.Count For i = 2 to x - 1 Sheets(i).PrintOut Next "Rick S." wrote: This one I just can not figure out. In my workbooks I will have many sheets, the first sheet and the last sheet will always have the same name, "Master Sheet" and "Rev Record" respectivily. I have a macro that prints the workbook but I do not want to print the first and last worksheets. (The macro does much more than just print). I use "ActiveWorkbook.PrintOut", which priints everything. My stumbling block is, I do not know how many sheets will exist between the first and last sheets nor do I know how to NOT print the two sheets mentioned. If you understand this querry, raise your hand! ;) Thanks in advance! -- Regards VBA.Noob.Confused XP Pro Office 2007 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Printing Most but not all worksheets | Excel Discussion (Misc queries) | |||
Printing worksheets | Excel Programming | |||
Printing worksheets | Excel Programming | |||
Printing? Worksheets not printing the same on multiple pc's! | Excel Programming | |||
Printing Worksheets thru VBA | Excel Programming |