Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trying to hide all rows where no data is in columns AQ-AV
I'm trying to hide all rows where no data is in columns AQ-AV then
print remaining rows ONLY. Here's what I came up with but it's not working. It is printing Row 4 only which is the column titles. There IS data in several of the cells AQ-AV so they shouldn't have hidden themselves but it appears that ALL rows have hidden. I appreciate any help to figure this out. Sub Print_6_Month_Forecast() Dim lngRow As Long Rows("1:3").EntireRow.Hidden = True Columns("A:C").EntireColumn.Hidden = True Columns("G:I").EntireColumn.Hidden = True Columns("K:K").EntireColumn.Hidden = True Columns("M:O").EntireColumn.Hidden = True Columns("R:R").EntireColumn.Hidden = True Columns("T:V").EntireColumn.Hidden = True Columns("X:AP").EntireColumn.Hidden = True Columns("AW:BC").EntireColumn.Hidden = True Rows("A5:IV1999").Sort Key1:=Range("AQ5"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _ Orientation:=xlTopToBottom, DataOption1:=xlSortNormal lngRow = Range("AQ5:AV1999").End(xlUp).Row + 1 Rows(lngRow & ":1999").EntireRow.Hidden = True Rows("A5:IV1999").Sort Key1:=Range("E5"), Order1:=xlAscending, Key2:=Range("J5"), Order2:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _ Orientation:=xlTopToBottom, DataOption1:=xlSortNormal ActiveSheet.PageSetup.PrintArea = Rows("4:" & lngRow - 1).Address '? With ActiveSheet.PageSetup .PrintTitleRows = "" .PrintTitleColumns = "" .LeftHeader = "PAGE NO. &P" .CenterHeader = "2007 Forecast 6-Months Rolling" .RightHeader = "&D, &T" .LeftFooter = "" .CenterFooter = "" .RightFooter = "" .LeftMargin = Application.InchesToPoints(0.75) .RightMargin = Application.InchesToPoints(0.75) .TopMargin = Application.InchesToPoints(1) .BottomMargin = Application.InchesToPoints(1) .HeaderMargin = Application.InchesToPoints(0.5) .FooterMargin = Application.InchesToPoints(0.5) .PrintHeadings = False .PrintGridlines = False .PrintComments = xlPrintNoComments .PrintQuality = 600 .CenterHorizontally = False .CenterVertically = False .Orientation = xlLandscape .Draft = False .PaperSize = xlPaperLetter .FirstPageNumber = xlAutomatic .Order = xlDownThenOver .BlackAndWhite = False .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = 4 .PrintErrors = xlPrintErrorsDisplayed End With ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True Cells.Select Selection.EntireRow.Hidden = False Selection.EntireColumn.Hidden = False Rows("A5:IV1999").Select Selection.Sort Key1:=Range("B5"), Order1:=xlAscending, Key2:=Range("A5") _ , Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal Range("A4").Select End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Want to Hide columns in spreadsheet but NOT hide data in chart. | Charts and Charting in Excel | |||
Hide columns but not the top rows | Excel Discussion (Misc queries) | |||
Hide columns and rows | Excel Worksheet Functions | |||
Auto Hide Columns & Rows | Excel Discussion (Misc queries) | |||
Hide Rows and Columns | Excel Programming |