carlleese24
Board Regular
- Joined
- Mar 15, 2005
- Messages
- 108
Hi
Hoping someone can help me I am trying to create 2 worksheet change private sub functions in my excel sheet but then I have then as the same name an error occurs
compile error ambiguous name detected worksheet change and also if I change the name the code does not work is there any way to solve this problem here is my code for it.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim iColor As Integer
' Multiple Conditional Format
Dim rng As Range
' Only look at single cell changes
Dim rng2 As Range
' Only look at single cell changes
If Target.Count > 1 Then Exit Sub
Set rng = Range("L22:L1000")
' Only look at that range
If Intersect(Target, rng) Is Nothing Then Exit Sub
If Target.Offset(0, 0) = 5 Then
Target.Offset(0, 0).Interior.ColorIndex = 51
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim iColor As Integer
' Multiple Conditional Format
Dim rng As Range
' Only look at single cell changes
Dim rng2 As Range
' Only look at single cell changes
If Target.Count > 1 Then Exit Sub
Set rng = Range("M22:M1000")
' Only look at that range
If Intersect(Target, rng) Is Nothing Then Exit Sub
If Target.Offset(0, 0) = 10 Then
Target.Offset(0, 0).Interior.ColorIndex = 51
End If
Carl
Hoping someone can help me I am trying to create 2 worksheet change private sub functions in my excel sheet but then I have then as the same name an error occurs
compile error ambiguous name detected worksheet change and also if I change the name the code does not work is there any way to solve this problem here is my code for it.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim iColor As Integer
' Multiple Conditional Format
Dim rng As Range
' Only look at single cell changes
Dim rng2 As Range
' Only look at single cell changes
If Target.Count > 1 Then Exit Sub
Set rng = Range("L22:L1000")
' Only look at that range
If Intersect(Target, rng) Is Nothing Then Exit Sub
If Target.Offset(0, 0) = 5 Then
Target.Offset(0, 0).Interior.ColorIndex = 51
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim iColor As Integer
' Multiple Conditional Format
Dim rng As Range
' Only look at single cell changes
Dim rng2 As Range
' Only look at single cell changes
If Target.Count > 1 Then Exit Sub
Set rng = Range("M22:M1000")
' Only look at that range
If Intersect(Target, rng) Is Nothing Then Exit Sub
If Target.Offset(0, 0) = 10 Then
Target.Offset(0, 0).Interior.ColorIndex = 51
End If
Carl