Thread: Autorun a macro
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson[_2_] Chip Pearson[_2_] is offline
external usenet poster
 
Posts: 95
Default Autorun a macro

You can use the Change event procedure. In the code module for the
worksheet containing the list, uses the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("TheList")) Is Nothing Then
Application.EnableEvents = False
Range("TheList").Sort key1:=Range("TheList")(1, 1), _
order1:=xlAscending, header:=xlNo
Application.EnableEvents = True
End If
End Sub

Change "TheList" to the range in question.


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


wrote in message
...
Hello,

I have a macro set up to sort a list(s). Is it possible
to have the macro autorun if a value in the list is
updated?

Any help or suggestions are greatly appreciated