View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Printout Code Problem

If you mean a specific sheet:
Sub HideRows()
Dim i As Long
With worksheets("Sheet1")
For i = 5 To 206
.Rows(i).EntireRow.Hidden = _
.Range("BQ" & i).Value = 0
Next i
.PrintOut
End With
End Sub

if you mean make the 206 dynamic

Sub HideRows()
Dim i As Long, lastRow as long
lastRow = cells(rows.count,"A").end(xlup).row
For i = 5 To lastRow
Rows(i).EntireRow.Hidden = Range("BQ" & i).Value = 0
Next i
Range("A1").Select
ActiveSheet.PrintOut
End Sub

Change the "A" to indicate the column to test to find the last row


--
Regards,
Tom Ogilvy


"Jonsson " wrote in message
...
Hi,

How to modify the code down below, to prinout the numbers at one sheet.

Not as now on several sheets, as the conditions are tested down to row
206.

Sub HideRows()
Dim i As Long
For i = 5 To 206
Rows(i).EntireRow.Hidden = Range("BQ" & i).Value = 0
Next i
Range("A1").Select
ActiveSheet.PrintOut
End Sub


---
Message posted from http://www.ExcelForum.com/