Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro to select and print sheets
something like
for each ws in worksheets if ws.range("g1")0 then activesheet.printout next ws -- Don Guillett SalesAid Software "JoeP" wrote in message ... 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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Select Worksheet to print Macro | Excel Worksheet Functions | |||
Print Macro both sheets at once with option to select days etc | Excel Worksheet Functions | |||
Create a print macro that would automatically select print area? | Excel Worksheet Functions | |||
macro to select data paste/print | Excel Worksheet Functions | |||
macro to select data/paste/print | Excel Worksheet Functions |