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: 1
Default Hide and printout area conditions

Hi all,

I´m trying to "clean" the worksheet from unused rows before printing
and then get a print out that only shows whats necessary. The "cleaned
area is different every time, depending wether there are numbers i
them or not. I´m using the code below, (thanks NOSPAM), but I get
very long "answertime" from this code. Is there anyway to modify it t
work from D5:D206? I think it would go faster if the area is specifie
to D5:D206, than to the bottom row, or.......?

I assume I have to modify it more than just change the area B:B
becouse that doesnt work.

Thanks in advance!

//Thomas


Sub CleanUporg()
Dim CurrentRow As Long
Dim UsedRows As Range
On Error GoTo Abort
Set UsedRows = ActiveSheet.UsedRange.Rows
For CurrentRow = UsedRows.Rows.Count To 1 Step -1
I
Application.WorksheetFunction.Sum(UsedRows.Rows(Cu rrentRow).Columns("B:B")
= 0 Then
UsedRows.Rows(CurrentRow).EntireRow.Hidden = True
Else: UsedRows.Rows(CurrentRow).EntireRow.Hidden = False
End If
Next CurrentRow
' If only hiding for printing purposes, use the next two lines to prin
or
'preview then restore the worksheet
'ActiveWindow.SelectedSheets.PrintPreview
'ActiveSheet.Rows.EntireRow.Hidden = False
Abort:
End Su

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

 
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
i want to hide the some plot area in a chart sc New Users to Excel 0 May 8th 08 07:09 AM
Hide a row and set print area shiro Excel Worksheet Functions 0 January 22nd 08 06:14 AM
Data label area in printout hmm Charts and Charting in Excel 1 November 16th 06 11:50 AM
no #VALUE! to printout garyww Excel Worksheet Functions 2 August 15th 06 04:19 PM
Pivot table Data area show/hide behavior Peter Ross Excel Discussion (Misc queries) 0 January 20th 06 10:37 PM


All times are GMT +1. The time now is 02:43 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"