Hello Guys
I have created a useful code for my work, see below. but the problem: This
code takes almost 3minutes
to complete running. can anyone help me tweaking this to work much better.
Sub UseColorz()
Range("n:n").Select
For Each Cell In Selection
If Cell.Value > 0.02 And Cell.Value <= 0.03 Then
Cell.Interior.Color = RGB(255, 255, 0)
Range("o16").Interior.Color = RGB(255, 255, 0)
Range("p16").Value = " 0.02 to 0.03"
End If
If Cell.Value > 0.03 And Cell.Value <= 0.04 Then
Cell.Interior.Color = RGB(255, 0, 255)
Range("o17").Interior.Color = RGB(255, 0, 255)
Range("p17").Value = " 0.03 to 0.04"
End If
If Cell.Value > 0.04 And Cell.Value <= 0.05 Then
Cell.Interior.Color = RGB(0, 255, 255)
Range("o18").Interior.Color = RGB(0, 255, 255)
Range("p18").Value = " 0.04 to 0.05"
End If
If Cell.Value > 0.05 And Cell.Value <= 0.06 Then
Cell.Interior.Color = RGB(128, 0, 0)
Range("o19").Interior.Color = RGB(128, 0, 0)
Range("p19").Value = " 0.05 to 0.06"
End If
If Cell.Value < 0.01 And Cell.Value <= 0.02 Then
Cell.Interior.Color = RGB(192, 192, 192)
Range("o21").Interior.Color = RGB(192, 192, 192)
Range("p21").Value = " 0.059 to 0.066"
End If
If Cell.Value > 0.06 And Cell.Value <= 0.07 Then
Cell.Interior.Color = RGB(153, 153, 255)
Range("o22").Interior.Color = RGB(153, 153, 255)
Range("p22").Value = " 0.066 to 0.073"
End If
If Cell.Value > 0.07 And Cell.Value <= 0.08 Then
Cell.Interior.Color = RGB(128, 128, 0)
Range("o23").Interior.Color = RGB(128, 128, 0)
Range("p23").Value = " Greater Than 0.073"
End If
Next
End Sub
--
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
To post to this group, send email to [email protected]
If you find any spam message in the group, please send an email to:
Ayush Jain @ [email protected] or
Ashish Jain @ [email protected]
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!
We reach over 6,500 subscribers worldwide and receive many nice notes about the
learning and support from the group. Our goal is to have 10,000 subscribers by
the end of 2009. Let friends and co-workers know they can subscribe to group at
http://groups.google.com/group/excel-macros/subscribe