View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Trevor Shuttleworth Trevor Shuttleworth is offline
external usenet poster
 
Posts: 1,089
Default Worksheet_Change

Greg

The WorkSheet_Change event has a Target Parameter. When a cell is changed
you can test Target.Row and Target.Column. Search the archives for
WorkSheet_Change; you should find lots of examples.

One example for colouring cells dependent on their value:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target.Row < 3 Then Exit Sub
If Not IsNumeric(Target.Value) Then Exit Sub
Select Case Int(Target.Value)
Case 1: Target.Interior.ColorIndex = 3 'red
Case 2: Target.Interior.ColorIndex = 36 'amber/yellow
Case 3: Target.Interior.ColorIndex = 27 'amber/dark yellow
Case 4: Target.Interior.ColorIndex = 4 'green
Case 5: Target.Interior.ColorIndex = 10 'dark green
Case Else: Target.Interior.ColorIndex = xlNone
End Select
End Sub

Regards

Trevor


"Greg Bloom" wrote in message
news:2Acqb.113315$Fm2.101544@attbi_s04...
Is there a way to tell what row and column you just left that was changed?

Greg