Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Macro to select and print sheets

I would like to know the code for use in a macro that will
1. look at cell G1 in a sheet and if there is a number in that cell print
the sheet
2. move to the next sheet and look at cell G1 and if there is a number in
that cell print the sheet
3. continue to move to each sheet in the file test cell G1 to see if there
is a number and print the sheet if there is.

Thanks for any help.
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Macro to select and print sheets

Option Explicit
Sub testme()

Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
With wks.Range("g1")
If IsEmpty(.Value) Then
'skip it
Else
If IsNumeric(.Value) Then
.Parent.PrintOut Preview:=True
End If
End If
End With
Next wks

End Sub

JoeP wrote:

I would like to know the code for use in a macro that will
1. look at cell G1 in a sheet and if there is a number in that cell print
the sheet
2. move to the next sheet and look at cell G1 and if there is a number in
that cell print the sheet
3. continue to move to each sheet in the file test cell G1 to see if there
is a number and print the sheet if there is.

Thanks for any help.


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Macro to select and print sheets

Thanks for all the help. This is the exact solution I needed.

"Dave Peterson" wrote:

Option Explicit
Sub testme()

Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
With wks.Range("g1")
If IsEmpty(.Value) Then
'skip it
Else
If IsNumeric(.Value) Then
.Parent.PrintOut Preview:=True
End If
End If
End With
Next wks

End Sub

JoeP wrote:

I would like to know the code for use in a macro that will
1. look at cell G1 in a sheet and if there is a number in that cell print
the sheet
2. move to the next sheet and look at cell G1 and if there is a number in
that cell print the sheet
3. continue to move to each sheet in the file test cell G1 to see if there
is a number and print the sheet if there is.

Thanks for any help.


--

Dave Peterson

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
Select Worksheet to print Macro Angel_24477616 Excel Worksheet Functions 0 March 19th 07 12:56 PM
Print Macro both sheets at once with option to select days etc pano Excel Worksheet Functions 0 January 29th 07 04:09 AM
Create a print macro that would automatically select print area? wastedwings Excel Worksheet Functions 7 August 22nd 05 10:36 PM
macro to select data paste/print Anthony Excel Worksheet Functions 1 January 30th 05 04:35 PM
macro to select data/paste/print Anthony Excel Worksheet Functions 1 January 29th 05 08:33 AM


All times are GMT +1. The time now is 11:23 AM.

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"