Sarath Karanam
New Member
- Joined
- Mar 14, 2013
- Messages
- 41
Hi,
I'm using a macro which is taking too long to run because of the number of cells it has to check.
I tried modifying it with no luck.
Though I added "cella <> Empty" to this, it still is taking long as it has to check all the 20000 cells.
I want to stop this macro if "cella = Empty". However, I'm not able to figure a way to do that.
Please help.
Regards,
Sarath Karanam
I'm using a macro which is taking too long to run because of the number of cells it has to check.
I tried modifying it with no luck.
Code:
Sub dup() Dim cell As Range, cella As Range, rng As Range, srng As Range
Set rng = Sheets(2).Range("A2:A20000")
Set srng = Sheets(1).Range("A2:A20000")
For Each cell In rng
For Each cella In srng
If cella = cell And cella <> Empty Then
cella.Interior.ColorIndex = 22
End If
Next cella
Next cell
End Sub
Though I added "cella <> Empty" to this, it still is taking long as it has to check all the 20000 cells.
I want to stop this macro if "cella = Empty". However, I'm not able to figure a way to do that.
Please help.
Regards,
Sarath Karanam