can you make this faster?
here is the code... is there a quicker way to do this?
Private Sub Worksheet_Calculate() Dim Target As Range For Each Target In Range("p4:p34") If Target.Value = True Then Cells(Target.Row, "G").Resize(1, 24).Interior.ColorIndex = 15 End If If Target.Value = False Then Cells(Target.Row, "G").Resize(1, 24).Interior.ColorIndex = xlNone End If Next End Sub |
can you make this faster?
Hi John,
John wrote: here is the code... is there a quicker way to do this? Private Sub Worksheet_Calculate() Dim Target As Range For Each Target In Range("p4:p34") If Target.Value = True Then Cells(Target.Row, "G").Resize(1, 24).Interior.ColorIndex = 15 End If If Target.Value = False Then Cells(Target.Row, "G").Resize(1, 24).Interior.ColorIndex = xlNone End If Next End Sub This is the perfect situation for conditional formatting: http://www.contextures.com/xlCondFormat03.html -- Regards, Jake Marx www.longhead.com [please keep replies in the newsgroup - email address unmonitored] |
can you make this faster?
Rewriting with the same If...Then structure gives me this... didn't
check the working (perhaps the set x... will give problems, just try it) Private Sub Worksheet_Calculate() Dim Target As Range set x = Cells(Target.Row, "G").Resize(1, 24).Interior.ColorIndex For Each Target In Range("p4:p34") If Target.Value = True Then x = 15 else x = xlNone End If Next End Sub Bye Baj |
All times are GMT +1. The time now is 11:42 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com