Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Macro That Deletes Rows Extremely Slow

I have an Excel macro that runs fine on many people's computers, but on one
person's machine the delete line (set off with asterisks below) takes
forever; when she gets to it, everything in the Task Manager related to
Microsoft Office (not just Excel) shows the ol' "Not Responding" message.
She has waited as long as 45 minutes before giving up on a process that takes
only a few seconds on other machines. Any ideas?

Sub DynamicGet(intField As Integer, strCriterion As String)
Columns("AA:AD").Select
Selection.AutoFilter Field:=intField, Criteria1:=strCriterion
Range("A2:BD30000").Select
**********Selection.EntireRow.Delete************
Selection.AutoFilter Field:=intField
Range("A2").Select
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Macro That Deletes Rows Extremely Slow

Could be several things, but you need to add this to the code.

Sub DynamicGet(intField As Integer, strCriterion As String)
Application.ScreenUpdating = False
application.Calculation=xlCalculationManual
Columns("AA:AD").Select
Selection.AutoFilter Field:=intField, Criteria1:=strCriterion
Range("A2:BD30000").Select
**********Selection.EntireRow.Delete************
Selection.AutoFilter Field:=intField
Range("A2").Select
Application.Calculation =xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"LarryP" wrote:

I have an Excel macro that runs fine on many people's computers, but on one
person's machine the delete line (set off with asterisks below) takes
forever; when she gets to it, everything in the Task Manager related to
Microsoft Office (not just Excel) shows the ol' "Not Responding" message.
She has waited as long as 45 minutes before giving up on a process that takes
only a few seconds on other machines. Any ideas?

Sub DynamicGet(intField As Integer, strCriterion As String)
Columns("AA:AD").Select
Selection.AutoFilter Field:=intField, Criteria1:=strCriterion
Range("A2:BD30000").Select
**********Selection.EntireRow.Delete************
Selection.AutoFilter Field:=intField
Range("A2").Select
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Macro That Deletes Rows Extremely Slow

Not sure why it takes so long on a particular machine (memory ?)

But the code would be more efficient if you did not select everything first

Untested changes.....

Sub DynamicGet(intField As Integer, strCriterion As String)
Columns("AA:AD").AutoFilter Field:=intField, Criteria1:=strCriterion
Rows("2:30000").EntireRow.Delete
Columns("AA:AD").AutoFilter Field:=intField
Range("A2").Select
End Sub



--

Regards,
Nigel




"LarryP" wrote in message
...
I have an Excel macro that runs fine on many people's computers, but on one
person's machine the delete line (set off with asterisks below) takes
forever; when she gets to it, everything in the Task Manager related to
Microsoft Office (not just Excel) shows the ol' "Not Responding" message.
She has waited as long as 45 minutes before giving up on a process that
takes
only a few seconds on other machines. Any ideas?

Sub DynamicGet(intField As Integer, strCriterion As String)
Columns("AA:AD").Select
Selection.AutoFilter Field:=intField, Criteria1:=strCriterion
Range("A2:BD30000").Select
**********Selection.EntireRow.Delete************
Selection.AutoFilter Field:=intField
Range("A2").Select
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Macro That Deletes Rows Extremely Slow

Thanks Nigel (and John). I've blended your two replies into my code, and on
my confuser it runs dandy, but of course I didn't have the problem before!
I've sent the concerned user a copy to run from her Desktop and see what
happens. More news at 11. Appreciate the quick replies.

"Nigel" wrote:

Not sure why it takes so long on a particular machine (memory ?)

But the code would be more efficient if you did not select everything first

Untested changes.....

Sub DynamicGet(intField As Integer, strCriterion As String)
Columns("AA:AD").AutoFilter Field:=intField, Criteria1:=strCriterion
Rows("2:30000").EntireRow.Delete
Columns("AA:AD").AutoFilter Field:=intField
Range("A2").Select
End Sub



--

Regards,
Nigel




"LarryP" wrote in message
...
I have an Excel macro that runs fine on many people's computers, but on one
person's machine the delete line (set off with asterisks below) takes
forever; when she gets to it, everything in the Task Manager related to
Microsoft Office (not just Excel) shows the ol' "Not Responding" message.
She has waited as long as 45 minutes before giving up on a process that
takes
only a few seconds on other machines. Any ideas?

Sub DynamicGet(intField As Integer, strCriterion As String)
Columns("AA:AD").Select
Selection.AutoFilter Field:=intField, Criteria1:=strCriterion
Range("A2:BD30000").Select
**********Selection.EntireRow.Delete************
Selection.AutoFilter Field:=intField
Range("A2").Select
End Sub


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Macro That Deletes Rows Extremely Slow

Bummer! Suggestions so far didn't fix the problem. All three code versions
(original, John's, and Nigel's) work like lightning on my computer and
several others I spot-checked, but not on this one user's. She has
uninstalled and completely reinstalled Office 2003, done a cleanup and
defrag, no change. Anyone else have a thought?

"LarryP" wrote:

I have an Excel macro that runs fine on many people's computers, but on one
person's machine the delete line (set off with asterisks below) takes
forever; when she gets to it, everything in the Task Manager related to
Microsoft Office (not just Excel) shows the ol' "Not Responding" message.
She has waited as long as 45 minutes before giving up on a process that takes
only a few seconds on other machines. Any ideas?

Sub DynamicGet(intField As Integer, strCriterion As String)
Columns("AA:AD").Select
Selection.AutoFilter Field:=intField, Criteria1:=strCriterion
Range("A2:BD30000").Select
**********Selection.EntireRow.Delete************
Selection.AutoFilter Field:=intField
Range("A2").Select
End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro That Deletes Rows Extremely Slow

Hi LarryP

You can find more code to test on this page
http://www.rondebruin.nl/delete.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"LarryP" wrote in message ...
Bummer! Suggestions so far didn't fix the problem. All three code versions
(original, John's, and Nigel's) work like lightning on my computer and
several others I spot-checked, but not on this one user's. She has
uninstalled and completely reinstalled Office 2003, done a cleanup and
defrag, no change. Anyone else have a thought?

"LarryP" wrote:

I have an Excel macro that runs fine on many people's computers, but on one
person's machine the delete line (set off with asterisks below) takes
forever; when she gets to it, everything in the Task Manager related to
Microsoft Office (not just Excel) shows the ol' "Not Responding" message.
She has waited as long as 45 minutes before giving up on a process that takes
only a few seconds on other machines. Any ideas?

Sub DynamicGet(intField As Integer, strCriterion As String)
Columns("AA:AD").Select
Selection.AutoFilter Field:=intField, Criteria1:=strCriterion
Range("A2:BD30000").Select
**********Selection.EntireRow.Delete************
Selection.AutoFilter Field:=intField
Range("A2").Select
End Sub

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Macro That Deletes Rows Extremely Slow

Lots of info there. The Union idea is new to me and looks interesting; will
give it a go. Thanks.

"Ron de Bruin" wrote:

Hi LarryP

You can find more code to test on this page
http://www.rondebruin.nl/delete.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"LarryP" wrote in message ...
Bummer! Suggestions so far didn't fix the problem. All three code versions
(original, John's, and Nigel's) work like lightning on my computer and
several others I spot-checked, but not on this one user's. She has
uninstalled and completely reinstalled Office 2003, done a cleanup and
defrag, no change. Anyone else have a thought?

"LarryP" wrote:

I have an Excel macro that runs fine on many people's computers, but on one
person's machine the delete line (set off with asterisks below) takes
forever; when she gets to it, everything in the Task Manager related to
Microsoft Office (not just Excel) shows the ol' "Not Responding" message.
She has waited as long as 45 minutes before giving up on a process that takes
only a few seconds on other machines. Any ideas?

Sub DynamicGet(intField As Integer, strCriterion As String)
Columns("AA:AD").Select
Selection.AutoFilter Field:=intField, Criteria1:=strCriterion
Range("A2:BD30000").Select
**********Selection.EntireRow.Delete************
Selection.AutoFilter Field:=intField
Range("A2").Select
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
Excel macro in 2007 runs extremely slow Acie Excel Discussion (Misc queries) 3 March 3rd 09 04:22 PM
Extremely slow macro CLR Excel Programming 3 January 17th 07 06:58 PM
macro running extremely slow sloth Excel Programming 4 October 4th 06 04:31 PM
Macro that deletes certain rows only supamari0 Excel Programming 7 June 9th 06 04:11 PM
Macro that deletes certain rows and not others Roger[_20_] Excel Programming 8 May 3rd 05 12:02 AM


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