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: 15
Default Clean Up without reducing print window.

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!
 
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
Disabling OneNote Print Window on Excel Cris Excel Discussion (Misc queries) 0 August 11th 09 09:36 AM
Macro to open print window and set to print entire workbook retseort Excel Discussion (Misc queries) 1 October 27th 05 11:00 PM
VB code to open Print window OscarC Excel Programming 4 December 6th 04 11:18 PM
Customizing print preview window Chip Pearson Excel Programming 0 August 22nd 03 01:18 PM
How do I disable the Margins button in Print Preview Window John[_35_] Excel Programming 0 July 23rd 03 03:43 AM


All times are GMT +1. The time now is 02:30 AM.

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

About Us

"It's about Microsoft Excel"