#1   Report Post  
Posted to microsoft.public.excel.programming
tjh tjh is offline
external usenet poster
 
Posts: 96
Default Speed

Hello,

I use several Do Loops or For Next loops with If statements within my
macros. In most cases it will look through 2K rows before quitting. One
example is the one below, which hides rows based on certain color
requirements. The ColorIndex statement is referencing another function for
the certain color. Is there a faster method to loop through data, such as
this? Many of my macros have gotten very slow.

Range("b8").Select
Do
If ActiveCell.Font.ColorIndex = -4105 Then
If ActiveCell.Value = "" And ActiveCell.Offset(-1, 0).Font.Bold = True
Then
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.EntireRow.Hidden = True
ActiveCell.Offset(1, 0).Select
End If
Else
If ActiveCell.Font.Bold = True Then
Else
ActiveCell.Offset(0, 14).Value = Round(((Cells(ActiveCell.row,
15).Value) / 1000000), 1)
End If
ActiveCell.Offset(1, 0).Select
End If

Loop Until ActiveCell.Value = "" And ActiveCell.Offset(-1, 0).Value = "" And
ActiveCell.Offset(-2, 0).Value = "" And ActiveCell.Offset(-3, 0).Value = ""
And ActiveCell.Offset(-4, 0).Value = "" And ActiveCell.Offset(-5, 0).Value =
""
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Speed

You posted this question on 11/18/2004 and it appears as though no one
responded to your inquiry. If you are still attempting to solve the problem
of "Speed", then re-post your question in this NewsGroup and one of us will
take a fresh look at it. On your original posting, you should click the YES
or NO buttons to close out that entry on the system.

Steve in Ohio

"tjh" wrote:

Hello,

I use several Do Loops or For Next loops with If statements within my
macros. In most cases it will look through 2K rows before quitting. One
example is the one below, which hides rows based on certain color
requirements. The ColorIndex statement is referencing another function for
the certain color. Is there a faster method to loop through data, such as
this? Many of my macros have gotten very slow.

Range("b8").Select
Do
If ActiveCell.Font.ColorIndex = -4105 Then
If ActiveCell.Value = "" And ActiveCell.Offset(-1, 0).Font.Bold = True
Then
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.EntireRow.Hidden = True
ActiveCell.Offset(1, 0).Select
End If
Else
If ActiveCell.Font.Bold = True Then
Else
ActiveCell.Offset(0, 14).Value = Round(((Cells(ActiveCell.row,
15).Value) / 1000000), 1)
End If
ActiveCell.Offset(1, 0).Select
End If

Loop Until ActiveCell.Value = "" And ActiveCell.Offset(-1, 0).Value = "" And
ActiveCell.Offset(-2, 0).Value = "" And ActiveCell.Offset(-3, 0).Value = ""
And ActiveCell.Offset(-4, 0).Value = "" And ActiveCell.Offset(-5, 0).Value =
""

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
VBA Speed up sparx Excel Discussion (Misc queries) 2 April 29th 06 04:59 PM
Can you speed UP drag speed? Ryan W Excel Discussion (Misc queries) 1 October 24th 05 06:09 PM
I need mor Speed!!!! MESTRELLA29 Excel Discussion (Misc queries) 0 February 11th 05 02:51 PM
need for speed! Neil[_19_] Excel Programming 1 May 19th 04 10:25 PM
Speed? Stu[_31_] Excel Programming 11 October 18th 03 09:41 PM


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