Clean Up without reducing print window.
- From: Ryan Hess <RyanHess@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 10 Jan 2008 07:31:11 -0800
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 Work***
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 Active***
.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"
Active***.Range("A10").Select
End Sub
Thank you!
.
- Prev by Date: Re: Update sheetname from cell, automatically
- Next by Date: Re: how to set pivotitem.visible property to true
- Previous by thread: Re: Alter macro security level programmatically
- Next by thread: Re: Auto Copy from Sheet1 to Sheet2
- Index(es):