View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Worksheet Change event problem

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("K12:K160")) Is Nothing Then
' With Target
'For n = 12 To 160
n = Target.Row
If UCase(Cells(n, 13)) = "GRASS" Then
Cells(n, 14).Value = "No N"
Else: Cells(n, 14) = ""
End If
' Next n
' End With
End If
ws_exit:
Application.EnableEvents = True
End Sub


--
Don Guillett
SalesAid Software

"Graham Haughs" wrote in message
...
Thanks for that Don but getting no entries of "No N" in column N at all
now. A bit confused with < if ucase(target)="GRASS" then as text "Grass"
is in column N. Appreciate your input however and will persevere with what
you sent.

Graham

Don Guillett wrote:
try
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("K12:K160")) Is Nothing Then

' With Target
'For n = 12 To 160
'If Cells(n, 13) = "Grass" Then

n=target.row
if ucase(target)="GRASS" then
Cells(n, 14).Value = "No N"
Else
Cells(n, 14) = ""
End If

' Next n
' End With
End If
ws_exit:
Application.EnableEvents = True
End Sub