Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA Speed up | Excel Discussion (Misc queries) | |||
Can you speed UP drag speed? | Excel Discussion (Misc queries) | |||
I need mor Speed!!!! | Excel Discussion (Misc queries) | |||
need for speed! | Excel Programming | |||
Speed? | Excel Programming |