Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Slow Macros ...3

Hi Tom

The first time the code runs it works a treat 5 seconds
to delete the rows, however the second time it runs it
takes 25 seconds. I guess there is no getting around this.
-----Original Message-----
there was a typo on one line where Value was vaue. Once

corrected, it
worked fine for me.

Sub Delete_Row_600_551()
Dim res As Long
Dim i As Long
Sheets("Data").Select
res = Application.Calculation
Application.Calculation = xlManual
Application.ScreenUpdating = False
For i = 600 To 551 Step -1
If Cells(i, "G").Value < Range("Q1") Or _
Cells(i, "G").Value Range("S1") Then
Cells(i, "G").EntireRow.Delete
End If
Next i
Application.Calculation = res
Application.ScreenUpdating = True
End Sub


--
Regards,
Tom Ogilvy

"Sanj" wrote in

message
...
Hi Tom

I kept getting a Debug error for some reason, I

couldn't
see a fault with the macro though can you help

cheers


-----Original Message-----
Sub Delete_Row_600_551()
Dim res as Long
Dim i as Long
Sheets("Data").Select
res = Application.Calculation
application.Calculation = xlManual
Application.ScreenUpdating = False
for i = 600 to 551 step -1
If Cells(i,"G").Value< Range("Q1") or _
Cells(i,"G").Vaue Range("S1") Then
cells(i,"G").EntireRow.Delete
End if
Next i
Application.Calculation = res
Application.ScreenUpdating = True
End Sub

--
Regards,
Tom Ogilvy


wrote in message
...
Here is a small Example

Sub Delete_Row_600_551()

Sheets("Data").Select

If Range("G600") < Range("Q1") Then
Rows("600:600").Select
Selection.Delete Shift:=xlUp
End If

If Range("G600") Range("S1") Then
Rows("600:600").Select
Selection.Delete Shift:=xlUp
End If


If Range("G599") < Range("Q1") Then
Rows("599:599").Select
Selection.Delete Shift:=xlUp
End If

If Range("G599") Range("S1") Then
Rows("599:599").Select
Selection.Delete Shift:=xlUp
End If
End Sub


-----Original Message-----
Can you post your script here? Otherwise I cannot

tell
you why it does
that....


---
Message posted from http://www.ExcelForum.com/

.



.



.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Slow Macros ...3

Try switching the view to Normal.

I have had a similar problem where it is in PBreak Preview.

Otherwise, pass Application.Save. That will also help if the spreadsheet has a lot of rows.

HTH, Paul.

"Sanj" wrote:

Hi Tom

The first time the code runs it works a treat 5 seconds
to delete the rows, however the second time it runs it
takes 25 seconds. I guess there is no getting around this.
-----Original Message-----
there was a typo on one line where Value was vaue. Once

corrected, it
worked fine for me.

Sub Delete_Row_600_551()
Dim res As Long
Dim i As Long
Sheets("Data").Select
res = Application.Calculation
Application.Calculation = xlManual
Application.ScreenUpdating = False
For i = 600 To 551 Step -1
If Cells(i, "G").Value < Range("Q1") Or _
Cells(i, "G").Value Range("S1") Then
Cells(i, "G").EntireRow.Delete
End If
Next i
Application.Calculation = res
Application.ScreenUpdating = True
End Sub


--
Regards,
Tom Ogilvy

"Sanj" wrote in

message
...
Hi Tom

I kept getting a Debug error for some reason, I

couldn't
see a fault with the macro though can you help

cheers


-----Original Message-----
Sub Delete_Row_600_551()
Dim res as Long
Dim i as Long
Sheets("Data").Select
res = Application.Calculation
application.Calculation = xlManual
Application.ScreenUpdating = False
for i = 600 to 551 step -1
If Cells(i,"G").Value< Range("Q1") or _
Cells(i,"G").Vaue Range("S1") Then
cells(i,"G").EntireRow.Delete
End if
Next i
Application.Calculation = res
Application.ScreenUpdating = True
End Sub

--
Regards,
Tom Ogilvy


wrote in message
...
Here is a small Example

Sub Delete_Row_600_551()

Sheets("Data").Select

If Range("G600") < Range("Q1") Then
Rows("600:600").Select
Selection.Delete Shift:=xlUp
End If

If Range("G600") Range("S1") Then
Rows("600:600").Select
Selection.Delete Shift:=xlUp
End If


If Range("G599") < Range("Q1") Then
Rows("599:599").Select
Selection.Delete Shift:=xlUp
End If

If Range("G599") Range("S1") Then
Rows("599:599").Select
Selection.Delete Shift:=xlUp
End If
End Sub


-----Original Message-----
Can you post your script here? Otherwise I cannot

tell
you why it does
that....


---
Message posted from http://www.ExcelForum.com/

.



.



.


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
Macros Running Sometimes Slow Sometimes Fast bigV Excel Discussion (Misc queries) 0 June 9th 08 03:13 PM
Excel 2002 - Slow macros Sanjeev S Excel Programming 12 June 10th 04 02:01 AM
Slow macros cont..... Sanj[_2_] Excel Programming 5 June 4th 04 07:41 AM
Excel Macros Slow in XP VBA New Guy Excel Programming 1 December 29th 03 09:56 PM
Macros run slow in XP Jerry Park Excel Programming 0 July 22nd 03 09:54 PM


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