PC Review


Reply
Thread Tools Rate Thread

Clean Up without reducing print window.

 
 
Ryan Hess
Guest
Posts: n/a
 
      10th Jan 2008
Currently I have a macro that searches column A row 9+ for a numeric value.
If no value is found in column A of that row, the row is deleted and all
other rows move up. The macro does this function just fine. The problem is,
it shrinks the print window when it deletes all these rows. Is there a way
to edit this macro so that it still deletes all the rows with nothing in
column A, still moves all rows with a value in column A up BUT does not
shrink the print window?

Code I currently use:

Sub CleanUp()

Dim wS1 As Worksheet
Dim DeleteValue As String
Dim rng As Range
Dim calcmode As Long

Set wS1 = Workbooks("Order Form.xls").Sheets("Order Form")

wS1.Unprotect Password:="xxxxx"

With Application
calcmode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

DeleteValue = ""

With ActiveSheet

.AutoFilterMode = False

.Range("A9:A" & .Rows.Count).AutoFilter Field:=1,
Criteria1:=DeleteValue

With .AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Delete
End With

.AutoFilterMode = False
End With

With Application
.ScreenUpdating = True
.Calculation = calcmode
End With

wS1.Protect Password:="xxxxx"
ActiveSheet.Range("A10").Select

End Sub

Thank you!
 
Reply With Quote
 
 
 
 
Ryan Hess
Guest
Posts: n/a
 
      10th Jan 2008
EDIT:

I think I'll keep this as it is. I do however have another Macro that I
use to restore the deleted rows. Is there a simple function/code I can enter
into this Macro to restore the Print Area to my desired range? For example,
my Clean Up macro reduces the Print Area to A1:G34. Then I run my Restore
macro and want the Print Area to change to A1:G109.

Thank you!
 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      10th Jan 2008
Don't set the print area until just before the pring command. That way, it
is not subject to change.

ActiveSheet.PageSetup.PrintArea = Range("A1:G109")
ActiveSheet.PrintOut

"Ryan Hess" wrote:

> EDIT:
>
> I think I'll keep this as it is. I do however have another Macro that I
> use to restore the deleted rows. Is there a simple function/code I can enter
> into this Macro to restore the Print Area to my desired range? For example,
> my Clean Up macro reduces the Print Area to A1:G34. Then I run my Restore
> macro and want the Print Area to change to A1:G109.
>
> Thank you!

 
Reply With Quote
 
Ryan Hess
Guest
Posts: n/a
 
      10th Jan 2008
That works great JLGWhiz!

Thanks again!


"JLGWhiz" wrote:

> Don't set the print area until just before the pring command. That way, it
> is not subject to change.
>
> ActiveSheet.PageSetup.PrintArea = Range("A1:G109")
> ActiveSheet.PrintOut
>
> "Ryan Hess" wrote:
>
> > EDIT:
> >
> > I think I'll keep this as it is. I do however have another Macro that I
> > use to restore the deleted rows. Is there a simple function/code I can enter
> > into this Macro to restore the Print Area to my desired range? For example,
> > my Clean Up macro reduces the Print Area to A1:G34. Then I run my Restore
> > macro and want the Print Area to change to A1:G109.
> >
> > Thank you!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
enlarging/reducing print size in Windows Mail Carson Windows Vista Mail 1 7th Jun 2009 12:12 AM
How do I print without reducing to small image? angbob Microsoft Word Document Management 3 5th Apr 2008 04:00 AM
Clean up blank window =?Utf-8?B?S2VpdGg=?= Windows XP Help 1 12th Apr 2007 09:10 PM
Decreasing font size below 8 or suggestions reducing number of spreadsheet pages to print bob green Microsoft Excel Misc 3 31st May 2004 09:11 PM
Reducing default XP-Pro Explorer Window Screen Size in Registry N H Windows XP Customization 1 21st Sep 2003 03:02 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:17 PM.