LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Speeding up a delete rows Macro


I don't know which posting to respond to. The quickest method of
deleteing rows is to add a formula into an auxillary column putt an X in
the column for row to delete. You can add the formula into row IV like
this


Sub Macro1()


Range("IV1").Formula = "=if(A1 5,X,Y)"

'then copy the formula down the entire
LastRow = Range("A" & Rows.Count).End(xlUp)
Range("IV1").Copy _
Destination:=Range("IV1:IV" & LastRow)

'Next replace formula in column IV with value
Range("IV1:IV" & LastRow).Copy
Range("IV1:IV" & LastRow).PasteSpecial Paste:=xlPasteValues


'Next sort on Row IV
Rows("1:" & LastRow).Sort _
header:=xlYes, _
key1:=Range("IV1"), _
Order:=xlAscending


'Now all you have to do is delete the X's.
'asume these is a header row
Columns("IV").AutoFilter
Columns("IV").AutoFilter Field:=1, Criteria1:="X"
Rows("2:" & LastRow).SpecialCells(Type:=xlCellTypeVisible).Del ete
Columns("IV").Delete
End Sub
this may seem like a lot of steps, but it is the quickest method


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=150619

Microsoft Office Help

 
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
Speeding up Hide rows code caroline Excel Programming 2 February 11th 09 06:41 PM
Speeding up execution of a Macro QuietMan Excel Programming 4 December 21st 07 09:13 PM
Speeding up Macro jayklmno Excel Programming 4 October 11th 06 03:54 AM
Speeding Up Macro in VBA VexedFist[_2_] Excel Programming 4 October 4th 06 09:13 PM
speeding up a macro Brenda[_5_] Excel Programming 4 August 21st 03 12:56 AM


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