Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Is there a faster way

NewLRow below = 7170
As a result this Macro runs for over 25 minutes;
Is there a faster way of getting this done?


Sub Macro3()
Application.ScreenUpdating = False
Dim NewLRow As Long
Dim r As Long
NewLRow = Cells(Rows.Count, 9).End(xlUp).Row
For r = NewLRow To 2 Step -1
If Cells(r, 9) = "" Then
Rows(r).Delete
End If
Next
Range("A1").Select
Selection.EntireRow.Delete
Selection.EntireColumn.Delete
Application.ScreenUpdating = True
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Is there a faster way

If the cells in the column are blank

Application.Calculation = xlManual
Columns(9).SpecialCells(xlBlanks).entireRow.Delete
Application.Calculation = xlAutomatic

--
Regards,
Tom Ogilvy

"Jim May" wrote in message
news:TF53d.325828$Oi.259881@fed1read04...
NewLRow below = 7170
As a result this Macro runs for over 25 minutes;
Is there a faster way of getting this done?


Sub Macro3()
Application.ScreenUpdating = False
Dim NewLRow As Long
Dim r As Long
NewLRow = Cells(Rows.Count, 9).End(xlUp).Row
For r = NewLRow To 2 Step -1
If Cells(r, 9) = "" Then
Rows(r).Delete
End If
Next
Range("A1").Select
Selection.EntireRow.Delete
Selection.EntireColumn.Delete
Application.ScreenUpdating = True
End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Is there a faster way

Thanks Tom;
Would restricting the range down from
Columns(9) [all rows 1-65000+] to say Range(I1:I7071)
shorten the time even more? like:

Range(I1:I7071).SpecialCells(xlBlanks).entireRow.D elete ?

Thanks,
JMay

"Tom Ogilvy" wrote in message
...
If the cells in the column are blank

Application.Calculation = xlManual
Columns(9).SpecialCells(xlBlanks).entireRow.Delete
Application.Calculation = xlAutomatic

--
Regards,
Tom Ogilvy

"Jim May" wrote in message
news:TF53d.325828$Oi.259881@fed1read04...
NewLRow below = 7170
As a result this Macro runs for over 25 minutes;
Is there a faster way of getting this done?


Sub Macro3()
Application.ScreenUpdating = False
Dim NewLRow As Long
Dim r As Long
NewLRow = Cells(Rows.Count, 9).End(xlUp).Row
For r = NewLRow To 2 Step -1
If Cells(r, 9) = "" Then
Rows(r).Delete
End If
Next
Range("A1").Select
Selection.EntireRow.Delete
Selection.EntireColumn.Delete
Application.ScreenUpdating = True
End Sub






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Is there a faster way

Probably not. In this context, specialcells should not select beyond the
UsedRange. If your UsedRange extends well beyond the last filled cell, then
you might use what you suggest or use it any way: in any event it certainly
shouldn't make it slower I wouldn't think.

You can test it.

Sub AAAC()
Dim rng As Range
Set rng = Columns(9).SpecialCells(xlBlanks)
Set rng = rng.Areas(rng.Areas.Count)
Application.Goto rng(rng.Count)

End Sub

to see what the last cell addressed is.

--
Regards,
Tom Ogilvy





"Jim May" wrote in message
news:4Z63d.325831$Oi.291840@fed1read04...
Thanks Tom;
Would restricting the range down from
Columns(9) [all rows 1-65000+] to say Range(I1:I7071)
shorten the time even more? like:

Range(I1:I7071).SpecialCells(xlBlanks).entireRow.D elete ?

Thanks,
JMay

"Tom Ogilvy" wrote in message
...
If the cells in the column are blank

Application.Calculation = xlManual
Columns(9).SpecialCells(xlBlanks).entireRow.Delete
Application.Calculation = xlAutomatic

--
Regards,
Tom Ogilvy

"Jim May" wrote in message
news:TF53d.325828$Oi.259881@fed1read04...
NewLRow below = 7170
As a result this Macro runs for over 25 minutes;
Is there a faster way of getting this done?


Sub Macro3()
Application.ScreenUpdating = False
Dim NewLRow As Long
Dim r As Long
NewLRow = Cells(Rows.Count, 9).End(xlUp).Row
For r = NewLRow To 2 Step -1
If Cells(r, 9) = "" Then
Rows(r).Delete
End If
Next
Range("A1").Select
Selection.EntireRow.Delete
Selection.EntireColumn.Delete
Application.ScreenUpdating = True
End Sub








Reply
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
How do I print faster? vito Excel Discussion (Misc queries) 3 August 26th 09 06:18 PM
can this be done faster? Frank Excel Discussion (Misc queries) 7 August 9th 07 10:02 PM
Can faster CPU+larger/faster RAM significantly speed up recalulati jmk_li Excel Discussion (Misc queries) 2 September 28th 05 10:24 AM
Which one is faster? Syed Zeeshan Haider[_4_] Excel Programming 14 December 4th 03 05:28 PM
Shorter and faster? Stu[_28_] Excel Programming 5 October 17th 03 09:07 PM


All times are GMT +1. The time now is 11:01 AM.

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

About Us

"It's about Microsoft Excel"