Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 846
Default Unique print macro question

Excel 2003 -

Workbook has many sheets - all but three are hidden.

"shtInput" is always visible

What I want to do is to control which sheet get printed first and I want the
sheet that has a sheet name ending in "v" print first and the other sheet to
print second. There will always be only one visible sheet that has a sheet
name ending if "v".

Below is the working macro that I would like to add to. Any help would be
greatly appreciated.




Sub Print_pages()
Dim sht As Worksheet
shtAgent.Visible = False
For Each sht In Worksheets
If sht.Name < shtInput.Name And sht.Visible = True Then
sht.PrintOut
End If
Next
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 846
Default Unique print macro question

Okay I got this far

Sub Print_pages()
Dim sht As Worksheet
Dim page1 As String
Dim page2 As String
shtAgent.Visible = False
For Each sht In Worksheets
If sht.Name < shtInput.Name And sht.Visible = True Then
If (Right(sht.CodeName, 1) = "V") Then
page1 = sht.Name
Else
page2 = sht.Name
' sht.PrintOut
End If
End If
Next
' page1.PrintOut
' page2.PrintOut
End Sub

But how do I tell it to print out page1 and page2? Get an error message
with page1.printout


"Brad" wrote:

Excel 2003 -

Workbook has many sheets - all but three are hidden.

"shtInput" is always visible

What I want to do is to control which sheet get printed first and I want the
sheet that has a sheet name ending in "v" print first and the other sheet to
print second. There will always be only one visible sheet that has a sheet
name ending if "v".

Below is the working macro that I would like to add to. Any help would be
greatly appreciated.




Sub Print_pages()
Dim sht As Worksheet
shtAgent.Visible = False
For Each sht In Worksheets
If sht.Name < shtInput.Name And sht.Visible = True Then
sht.PrintOut
End If
Next
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 846
Default Unique print macro question

Got it

Replace the last two lines with
worksheet(page1).printout
worksheet(page2).printout

"Brad" wrote:

Excel 2003 -

Workbook has many sheets - all but three are hidden.

"shtInput" is always visible

What I want to do is to control which sheet get printed first and I want the
sheet that has a sheet name ending in "v" print first and the other sheet to
print second. There will always be only one visible sheet that has a sheet
name ending if "v".

Below is the working macro that I would like to add to. Any help would be
greatly appreciated.




Sub Print_pages()
Dim sht As Worksheet
shtAgent.Visible = False
For Each sht In Worksheets
If sht.Name < shtInput.Name And sht.Visible = True Then
sht.PrintOut
End If
Next
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.misc
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Unique print macro question


try
For Each sht In Worksheets
If sht.Name < shtInput.Name And sht.Visible = True Then
If (Right(sht.CodeName, 1) = "V") Then sht.printout
end if
next
For Each sht In Worksheets
If sht.Name < shtInput.Name And sht.Visible = True Then
If (Right(sht.CodeName, 1) < "V") Then sht.printout
end if
next







"Brad" wrote:


Okay I got this far

Sub Print_pages()
Dim sht As Worksheet
Dim page1 As String
Dim page2 As String
shtAgent.Visible = False
For Each sht In Worksheets
If sht.Name < shtInput.Name And sht.Visible = True Then
If (Right(sht.CodeName, 1) = "V") Then
page1 = sht.Name
Else
page2 = sht.Name
' sht.PrintOut
End If
End If
Next
' page1.PrintOut
' page2.PrintOut
End Sub

But how do I tell it to print out page1 and page2? Get an error message
with page1.printout


"Brad" wrote:

Excel 2003 -

Workbook has many sheets - all but three are hidden.

"shtInput" is always visible

What I want to do is to control which sheet get printed first and I want the
sheet that has a sheet name ending in "v" print first and the other sheet to
print second. There will always be only one visible sheet that has a sheet
name ending if "v".

Below is the working macro that I would like to add to. Any help would be
greatly appreciated.




Sub Print_pages()
Dim sht As Worksheet
shtAgent.Visible = False
For Each sht In Worksheets
If sht.Name < shtInput.Name And sht.Visible = True Then
sht.PrintOut
End If
Next
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question with existing print macro Newbeetle Excel Discussion (Misc queries) 5 February 13th 07 10:05 AM
Display Unique Values Question carl Excel Worksheet Functions 1 June 2nd 06 06:34 AM
how to print a page many times but add a unique reference on each ms_540 Excel Worksheet Functions 1 April 6th 06 07:42 PM
Print unique values omnibrown Excel Worksheet Functions 3 January 13th 06 12:40 AM
Pivot Table macro to set print area and print details of drill down data Steve Haskins Excel Discussion (Misc queries) 2 December 28th 05 04:59 PM


All times are GMT +1. The time now is 06:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"