![]() |
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. |
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. |
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 |
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 |
All times are GMT +1. The time now is 03:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com