LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default 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
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
Want to Hide columns in spreadsheet but NOT hide data in chart. KrispyData Charts and Charting in Excel 1 March 20th 09 04:45 PM
Hide columns but not the top rows Oceangate Excel Discussion (Misc queries) 8 November 25th 08 05:46 PM
Hide columns and rows delete automatically Excel Worksheet Functions 2 September 25th 07 12:49 AM
Auto Hide Columns & Rows appeng Excel Discussion (Misc queries) 2 March 25th 05 04:43 PM
Hide Rows and Columns Stuart Steven Excel Programming 5 July 17th 04 04:46 AM


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

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

About Us

"It's about Microsoft Excel"