daniel22bg
New Member
- Joined
- Nov 21, 2008
- Messages
- 31
Hi There,
I have a range of about 500 cells, some of which are empty and others are numbers. I would like to divide all the numbers with VBA by 100 without affecting the empty cells. Now i have the following Loop, which takes awfully lot of time. Can I avoid these loops somehow, so that I can optimize my code? Thanks a lot
I have a range of about 500 cells, some of which are empty and others are numbers. I would like to divide all the numbers with VBA by 100 without affecting the empty cells. Now i have the following Loop, which takes awfully lot of time. Can I avoid these loops somehow, so that I can optimize my code? Thanks a lot
Code:
Dim Rng As Range
For Each Rng In Sheets("1").Range("A1:A500"))
If Not (IsEmpty(Rng)) Then
Rng.Value = Rng.Value / 100
End If
Next Rng