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: 8
Default removing blank rows taking a long time

I have a list of various lengths (from 500 to 12000 rows) on which I want to
run a series of macros automatically then filter. The list has a column
containing dates in text format and blank rows between the months. If I want
to use Autofilter I have to remove the blank rows, so I wrote a macro to do
that. It does the job, but it takes about 23 seconds to do it. My other
macros run much faster, and I can't figure out why this one is so slow.
I would really appreciate any ideas on speeding it up because my next step
is to figure out how to run it automatically on hundreds of these lists.
Thanks in advance for any replies.
Here's the macro:

Sub RemoveBlanks()

Range("A401") = "Feb 1 *"
Range("B401").FormulaR1C1 = "=MATCH(RC[-1],C[12],0)-1"
Range("C401").FormulaR1C1 = "=ADDRESS(RC[-1],7,4)"
Range("D401").FormulaR1C1 = "=ADDRESS(RC[-2],19,4)"
Range("INDIRECT(C401):INDIRECT(D401)").Delete Shift:=xlUp
Range("A402") = "Mar 1 *"
Range("B402").FormulaR1C1 = "=MATCH(RC[-1],C[12],0)-1"
Range("C402").FormulaR1C1 = "=ADDRESS(RC[-1],7,4)"
Range("D402").FormulaR1C1 = "=ADDRESS(RC[-2],19,4)"
Range("INDIRECT(C402):INDIRECT(D402)").Delete Shift:=xlUp
Range("A403") = "Apr 1 *"
Range("B403").FormulaR1C1 = "=MATCH(RC[-1],C[12],0)-1"
Range("C403").FormulaR1C1 = "=ADDRESS(RC[-1],7,4)"
Range("D403").FormulaR1C1 = "=ADDRESS(RC[-2],19,4)"
Range("INDIRECT(C403):INDIRECT(D403)").Delete Shift:=xlUp
Range("A404") = "May 1 *"
Range("B404").FormulaR1C1 = "=MATCH(RC[-1],C[12],0)-1"
Range("C404").FormulaR1C1 = "=ADDRESS(RC[-1],7,4)"
Range("D404").FormulaR1C1 = "=ADDRESS(RC[-2],19,4)"
Range("INDIRECT(C404):INDIRECT(D404)").Delete Shift:=xlUp
Range("A405") = "Jun 1 *"
Range("B405").FormulaR1C1 = "=MATCH(RC[-1],C[12],0)-1"
Range("C405").FormulaR1C1 = "=ADDRESS(RC[-1],7,4)"
Range("D405").FormulaR1C1 = "=ADDRESS(RC[-2],19,4)"
Range("INDIRECT(C405):INDIRECT(D405)").Delete Shift:=xlUp
Range("A406") = "Jul 1 *"
Range("B406").FormulaR1C1 = "=MATCH(RC[-1],C[12],0)-1"
Range("C406").FormulaR1C1 = "=ADDRESS(RC[-1],7,4)"
Range("D406").FormulaR1C1 = "=ADDRESS(RC[-2],19,4)"
Range("INDIRECT(C406):INDIRECT(D406)").Delete Shift:=xlUp
Range("A407") = "Aug 1 *"
Range("B407").FormulaR1C1 = "=MATCH(RC[-1],C[12],0)-1"
Range("C407").FormulaR1C1 = "=ADDRESS(RC[-1],7,4)"
Range("D407").FormulaR1C1 = "=ADDRESS(RC[-2],19,4)"
Range("INDIRECT(C407):INDIRECT(D407)").Delete Shift:=xlUp
Range("A408") = "Sep 1 *"
Range("B408").FormulaR1C1 = "=MATCH(RC[-1],C[12],0)-1"
Range("C408").FormulaR1C1 = "=ADDRESS(RC[-1],7,4)"
Range("D408").FormulaR1C1 = "=ADDRESS(RC[-2],19,4)"
Range("INDIRECT(C408):INDIRECT(D408)").Delete Shift:=xlUp
Range("A409") = "Oct 1 *"
Range("B409").FormulaR1C1 = "=MATCH(RC[-1],C[12],0)-1"
Range("C409").FormulaR1C1 = "=ADDRESS(RC[-1],7,4)"
Range("D409").FormulaR1C1 = "=ADDRESS(RC[-2],19,4)"
Range("INDIRECT(C409):INDIRECT(D409)").Delete Shift:=xlUp
Range("A410") = "Nov 1 *"
Range("B410").FormulaR1C1 = "=MATCH(RC[-1],C[12],0)-1"
Range("C410").FormulaR1C1 = "=ADDRESS(RC[-1],7,4)"
Range("D410").FormulaR1C1 = "=ADDRESS(RC[-2],19,4)"
Range("INDIRECT(C410):INDIRECT(D410)").Delete Shift:=xlUp
Range("A411") = "Dec 1 *"
Range("B411").FormulaR1C1 = "=MATCH(RC[-1],C[12],0)-1"
Range("C411").FormulaR1C1 = "=ADDRESS(RC[-1],7,4)"
Range("D411").FormulaR1C1 = "=ADDRESS(RC[-2],19,4)"
Range("INDIRECT(C411):INDIRECT(D411)").Delete Shift:=xlUp

End Sub

The cells in columns A:F are used for calculations to row 369.
The columns are as follows:
A B C D E F G H I J K L
M N O
Pt1 Hs1 Aspect Pt2 Hs2 Event
Type Day Time

Thanks again.
 
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
Pasting in Excel has started taking a long time. Goshawk989 Excel Discussion (Misc queries) 0 April 18th 10 12:38 PM
Processing taking a really long time SS Excel Discussion (Misc queries) 2 March 17th 09 02:19 PM
Subtotalling taking long time to complete AndyV Excel Worksheet Functions 4 July 14th 08 03:10 PM
How to delete blank rows at one time in a long excel spreadsheet? lkurokawa Excel Worksheet Functions 2 March 19th 08 09:01 PM
Excel Taking Long TIme to Start Sanford Lefkowitz Excel Discussion (Misc queries) 2 June 1st 07 05:35 PM


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