sethmeister21
New Member
- Joined
- Mar 10, 2010
- Messages
- 20
Hello all - I'm dealing with a Worksheet_Change command in Excel 2003....Q: I don't think it's possible to have Multiple Worksheet_Change commands on same worksheet? >>>>Well....I get an error message so Im guessing not...
How can i combine the following commands?
'this highlights rows that contains trigger words
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Text
Case "Hotmail"
Target.EntireRow.Interior.ColorIndex = 37
Case "Google"
Target.EntireRow.Interior.ColorIndex = 37
Case "Yahoo"
Target.EntireRow.Interior.ColorIndex = 37
Case "Bing"
Target.EntireRow.Interior.ColorIndex = 37
Case "AltaVista"
Target.EntireRow.Interior.ColorIndex = 37
End Select
Call Highlight_Event_Type
End Sub
Private Sub Worksheet_Change(ByVal Target As Range) 'Does the validation range still have validation? If HasValidation(Range("ValidationRange")) Then Exit Sub Else Application.Undo MsgBox "Your last operation was canceled." & _ "It would have deleted data validation rules.", vbCritical End IfEnd SubPrivate Function HasValidation(r) As Boolean' Returns True if every cell in Range r uses Data Validation On Error Resume Next x = r.Validation.Type If Err.Number = 0 Then HasValidation = True Else HasValidation = FalseEnd Function</PRE>
As ever, all help greatly appreciated!!
regards
S
How can i combine the following commands?
'this highlights rows that contains trigger words
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Text
Case "Hotmail"
Target.EntireRow.Interior.ColorIndex = 37
Case "Google"
Target.EntireRow.Interior.ColorIndex = 37
Case "Yahoo"
Target.EntireRow.Interior.ColorIndex = 37
Case "Bing"
Target.EntireRow.Interior.ColorIndex = 37
Case "AltaVista"
Target.EntireRow.Interior.ColorIndex = 37
End Select
Call Highlight_Event_Type
End Sub
Private Sub Worksheet_Change(ByVal Target As Range) 'Does the validation range still have validation? If HasValidation(Range("ValidationRange")) Then Exit Sub Else Application.Undo MsgBox "Your last operation was canceled." & _ "It would have deleted data validation rules.", vbCritical End IfEnd SubPrivate Function HasValidation(r) As Boolean' Returns True if every cell in Range r uses Data Validation On Error Resume Next x = r.Validation.Type If Err.Number = 0 Then HasValidation = True Else HasValidation = FalseEnd Function</PRE>
As ever, all help greatly appreciated!!
regards
S