![]() |
Test for value and hide or unhide based on result
Hi...
How would I test a cell in each worksheet of my workbook for a value, then hide that worksheet based on the result? Also, is there an "unhide all" function that can be implemented at the front end of such a macro routine? I have this for testing the value of each sheet's specific cell location as it steps through the sheets, butI would rather have it step through the whole sheet, hiding certain sheets, then performing a single workbook print job at the end. Is there a hide and an unhide function call? I want to insert that into the IF statement and move the print statement to the end and make it print the entire workbook minus the hidden sheets. quoted macro: Sub selprint() Dim i As Integer Dim currentsheet As Worksheet For i = 1 To ActiveWorkbook.Worksheets.Count Set currentsheet = ActiveWorkbook.Worksheets(i) Worksheets(i).Activate 'Skip empty sheets and hidden sheets If Application.CountA(currentsheet.Cells) < 0 And currentsheet.Visible (place this then call at end of above line) Then 'change the hard-coded cell here if not F52 If (Not IsNull(Range("F52"))) And (Range("F52").Value < 0) Then 'un-comment the next line when debugging completed ActiveSheet.PrintOut 'add comment at start of next line when debugging completed ' ActiveSheet.PrintPreview End If End If Next i End Sub |
All times are GMT +1. The time now is 05:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com