LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Worksheet Event Code

Hi group
I am using a worksheet event code to handle 3 condition formatting. The criteria cells are all linked to other sheets. How can I get the formatting updated since there is no manual change on the sheet? Also, I would like to only format the cells 0 in addition to the other criteria.

A1:A9 is car, train, plane, bike, or boat
B1:H1 is 0-10
If A1 is Car and B1 0 then RED
If A1 is Car and B2=0 then no format

My Code.....

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:A9")) Is Nothing Then
With Target
Select Case LCase(.Value)
Case "Car": .Offset(0, 7).Resize(1, 7).Interior.ColorIndex = 3
Case "Boat": .Offset(0, 7).Resize(1, 7).Interior.ColorIndex = 5
Case "Bike": .Offset(0, 7).Resize(1, 7).Interior.ColorIndex = 10
Case "Train": .Offset(0, 7).Resize(1, 7).Interior.ColorIndex = 19
Case "Plane": .Offset(0, 7).Resize(1, 7).Interior.ColorIndex = 20
End Select
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


Thanks in advance
 
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
Starting/Stopping Worksheet Event Code Paul987 Excel Discussion (Misc queries) 1 March 20th 06 04:43 PM
Where?Worksheet code module or Worksheet_SelectionChange event han Kenzie Excel Worksheet Functions 4 January 30th 06 09:41 PM
Worksheet Event Code chequer - ExcelForums.com Excel Worksheet Functions 0 November 10th 04 06:30 AM
event in worksheet switches to VB code window asiamood Excel Programming 0 February 20th 04 06:40 PM
help worksheet event code scott23 Excel Programming 2 January 6th 04 08:17 PM


All times are GMT +1. The time now is 02:33 PM.

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

About Us

"It's about Microsoft Excel"