View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Andibevan[_2_] Andibevan[_2_] is offline
external usenet poster
 
Posts: 128
Default Call Macro when Cell within Range Changes

Chip,

Thanks that's perfect. I am slightly confused as I have the following code
which runs a macro when the cell range is selected whereas your macro works
when the cell is changes.

I can see what the difference is but don't understand why swapping the range
and the target round makes such a difference.

Regards

Andi

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Range("A1:A10"), Target) Is Nothing Then
'Call your Macro
Else
End If
End Sub



"Chip Pearson" wrote in message
...
Andi,

Try the following:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A1:A10")) Is Nothing
Then
' do something
End If
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Andibevan" wrote
in message ...
Hi All,

I understand how to set up a worksheet so that a macro is
called when the
value of a specific cell changes (i.e. when Cell A1 changes),
but how do you
call a macro when a cell within a range changes (a1:a10).

I know this is simple but I can't find the right arguments?

Any ideas?

Ta

Andi