View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Matt Matt is offline
external usenet poster
 
Posts: 60
Default VBA syntax question

I am using the following to automatically run a particular code (xyz)
if a cell (A1) becomes 10.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Application.Intersect(Target, Range("A1")) Is Nothing Then
If Target.Value 10 Then
MsgBox "xyz"
End If
End If
End Sub

What if I want "xyz" to run not just if cell A1 10 but if A2 10 as
well? Or better yet, for each value in the entire range A:A that 10,
the code xyz will run.