Thread: Speed
View Single Post
  #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 =
""