Hi Jason, One way of speeding this up is to use:
Application.ScreenUpdating=False at the beginning of your code. (And don't forget the Application.ScreenUpdating=True at the end.) But I'm sure we could speed it up in other ways as well. Any chance of attaching the file, or a sample file? Regards - Dave. > Date: Tue, 6 Apr 2010 08:18:05 -0700 > Subject: $$Excel-Macros$$ Request Help to make code more efficient. > From: jsin...@gmail.com > To: excel-macros@googlegroups.com > > Hello all fellow fellow Macro friends :) > > I have a short bit of code that I was wondering if it's possible to > make it run more efficiently. When it runs currently it takes up to 1 > minute which seems like a long time. > > Notes: This is designed to remove an entire row if the condition is > met. There is no *real* set limit on the number of potential rows, but > in reality it shouldn't exceed 1,500 rows on a bad day. There is more > code that runs after this but it's basic formatting stuff that dos not > have a loop function in it. > > Regards, > Jason > > > > Dim rng As Range > Dim what As String > Dim what1 As String > Dim what2 As String > Dim what3 As String > Dim what4 As String > Dim what5 As String > Dim what6 As String > Dim what7 As String > Dim what8 As String > > > what = "FD" > what1 = "EX" > what2 = "NA" > what3 = "NB" > what4 = "NC" > what5 = "HN" > what6 = "CLD" > what7 = "Location" > what8 = "of" > > Do > Set rng = ActiveSheet.UsedRange.Find(what) > If rng Is Nothing Then > Exit Do > Else > Rows(rng.Row).Delete > End If > Loop > > Do > Set rng = ActiveSheet.UsedRange.Find(what1) > If rng Is Nothing Then > Exit Do > Else > Rows(rng.Row).Delete > End If > Loop > > Do > Set rng = ActiveSheet.UsedRange.Find(what2) > If rng Is Nothing Then > Exit Do > Else > Rows(rng.Row).Delete > End If > Loop > > Do > Set rng = ActiveSheet.UsedRange.Find(what3) > If rng Is Nothing Then > Exit Do > Else > Rows(rng.Row).Delete > End If > Loop > > Do > Set rng = ActiveSheet.UsedRange.Find(what4) > If rng Is Nothing Then > Exit Do > Else > Rows(rng.Row).Delete > End If > Loop > > Do > Set rng = ActiveSheet.UsedRange.Find(what5) > If rng Is Nothing Then > Exit Do > Else > Rows(rng.Row).Delete > End If > Loop > Do > Set rng = ActiveSheet.UsedRange.Find(what6) > If rng Is Nothing Then > Exit Do > Else > Rows(rng.Row).Delete > End If > Loop > Do > Set rng = ActiveSheet.UsedRange.Find(what7) > If rng Is Nothing Then > Exit Do > Else > Rows(rng.Row).Delete > End If > Loop > Do > Set rng = ActiveSheet.UsedRange.Find(what8) > If rng Is Nothing Then > Exit Do > Else > Rows(rng.Row).Delete > End If > Loop > > -- > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our Facebook Group @ > http://www.facebook.com/group.php?gid=287779555678 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > HELP US GROW !! > > We reach over 6,800 subscribers worldwide and receive many nice notes about > the learning and support from the group.Let friends and co-workers know they > can subscribe to group at > http://groups.google.com/group/excel-macros/subscribe > > To unsubscribe, reply using "remove me" as the subject. _________________________________________________________________ View photos of singles in your area! Looking for a hot date? http://clk.atdmt.com/NMN/go/150855801/direct/01/ -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our Facebook Group @ http://www.facebook.com/group.php?gid=287779555678 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 6,800 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe