Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autorun macro Josh Excel Discussion (Misc queries) 2 August 16th 09 02:19 PM
autorun a macro [email protected] New Users to Excel 2 January 24th 08 05:41 PM
Autorun Macro rexmann Excel Discussion (Misc queries) 2 August 2nd 06 02:03 PM
MACRO AUTORUN b52shut Excel Discussion (Misc queries) 1 December 15th 05 08:48 AM
autorun macro hke[_3_] Excel Programming 6 October 16th 03 01:18 PM


All times are GMT +1. The time now is 03:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"