LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.misc
bennyob
 
Posts: n/a
Default Select sheets from an array for printing

Thanks Bob!
Works a treat

"Bob Phillips" wrote:

Dim Sheet As Worksheet
Dim shStyle As Long
'will print sheet with a value 0 in C2
For Each Sheet In Sheets(Array("Sheet1", "Sheet3", "Sheet5", "Sheet7",
"Sheet9"))
If Sheet.Range("C2").Value 0 Then
shStyle = Sheet.Visible
Sheet.Visible = xlSheetVisible
Sheet.PrintPreview
Sheet.Visible = shStyle
End If
Next


--

HTH

RP
(remove nothere from the email address if mailing direct)


"bennyob" wrote in message
...
I need Help!!
I have a workbook with hidden sheets, I want to search the visible sheets
for those with value greater than 0 in C2 then print them.
Can someone show me where I am going wrong with this code?
Tahnks

Sub PrintSelectedSheets()
'will print sheet with a value 0 in C2
For Each Sheet In ThisArray.Sheets(Array("Sheet1", "Sheet3", "Sheet5",
"Sheet7", "Sheet9"))
Sheet.Activate
If Range("C2").Value 0 Then
ActiveSheet.PrintPreview
End If
Next
End Sub




 
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
Cells User Select Locked after upgrade to Excel 2002 TWilson Excel Discussion (Misc queries) 1 August 5th 05 12:22 PM
how do you "select locked cells" w/o "select unlocked cells"? princejohnpaulfin Excel Discussion (Misc queries) 3 July 16th 05 03:53 AM
Conversion SVC Excel Worksheet Functions 9 February 28th 05 02:29 PM
Dynamic Formulas with Dynamic Ranges Ralph Howarth Excel Worksheet Functions 5 January 21st 05 08:44 AM
VBA Import of text file & Array parsing of that data Dennis Excel Discussion (Misc queries) 4 November 28th 04 10:20 PM


All times are GMT +1. The time now is 11:29 PM.

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

About Us

"It's about Microsoft Excel"