what am I doing wrong - i keep getting method "Intersect" failed.
in plain english, what I want to do is, if the target is in column M and the value is going to Completed or Needs Follow Up, I want to do some things. 1) remove matching items from rest of workbook, (offset negative 12 horizontal), and 2) color font, depending on which value.
CODE
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim ws As Worksheet
Dim myVin As Range
If Not Intersect(Target, Range("m:m")) Is Nothing Then
If Target.Value = "Completed" Then
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> ActiveSheet.Name Then
Set myVin = ws.Cells.Find(what:=Target.Offset(0, -12).Value)
If Not myVin Is Nothing Then 'then we found it
myVin.EntireRow.ClearContents 'remove it
Target.EntireRow.Font.Color = RGB(0, 100, 0)
Target.EntireRow.Font.Bold = True
End If
End If
Next ws
ElseIf Target.Value = "Needs Follow Up" Then
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> ActiveSheet.Name Then
Set myVin = ws.Cells.Find(what:=Target.Offset(0, -12).Value)
If Not myVin Is Nothing Then 'then we found it
myVin.EntireRow.ClearContents 'remove it
Target.EntireRow.Font.Color = RGB(184, 134, 11)
Target.EntireRow.Font.Bold = True
End If
End If
Next ws
End If
End If
End Sub
Dim ws As Worksheet
Dim myVin As Range
If Not Intersect(Target, Range("m:m")) Is Nothing Then
If Target.Value = "Completed" Then
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> ActiveSheet.Name Then
Set myVin = ws.Cells.Find(what:=Target.Offset(0, -12).Value)
If Not myVin Is Nothing Then 'then we found it
myVin.EntireRow.ClearContents 'remove it
Target.EntireRow.Font.Color = RGB(0, 100, 0)
Target.EntireRow.Font.Bold = True
End If
End If
Next ws
ElseIf Target.Value = "Needs Follow Up" Then
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> ActiveSheet.Name Then
Set myVin = ws.Cells.Find(what:=Target.Offset(0, -12).Value)
If Not myVin Is Nothing Then 'then we found it
myVin.EntireRow.ClearContents 'remove it
Target.EntireRow.Font.Color = RGB(184, 134, 11)
Target.EntireRow.Font.Bold = True
End If
End If
Next ws
End If
End If
End Sub