Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autorun a macro
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autorun a macro
Use the WorkSheet_Change event
Private Sub Worksheet_Change(ByVal Target As Excel.Range) Dim Isect As Range Set Isect = Application.Intersect(Range("H16:H40"), Target) If Target.Count 1 Then Exit Sub End If If Isect Is Nothing Then Do things... Else Do these things... End If End Sub Hope it helps Lars Kofod Denmark -----Original 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 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Autorun macro | Excel Discussion (Misc queries) | |||
autorun a macro | New Users to Excel | |||
Autorun Macro | Excel Discussion (Misc queries) | |||
MACRO AUTORUN | Excel Discussion (Misc queries) | |||
autorun macro | Excel Programming |