Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default 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]


  #3   Report Post  
Posted to microsoft.public.excel.programming
baj baj is offline
external usenet poster
 
Posts: 24
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make Excel Work faster Siva New Users to Excel 1 April 7th 06 10:33 AM
How Can I make excel go faster Jason Zischke Excel Programming 8 March 23rd 05 03:55 PM
make my vba/excel program faster David Lee Excel Programming 0 May 18th 04 06:17 PM
make my vba/excel program faster Frank Kabel Excel Programming 0 May 18th 04 04:58 PM
make my VBA program faster Neil[_14_] Excel Programming 2 May 18th 04 04:15 PM


All times are GMT +1. The time now is 09:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"