Excel 2003 VBA formula for Auto Sorting

Closed
Bert2006 - Nov 24, 2009 at 08:16 PM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Nov 25, 2009 at 05:54 AM
Hello,
I have a worksheets (1) in which I have data in range A3:A10 that comes from another worksheets.
I am trying to auto sort the whole range A3:D10 base on any date changes in A3:A10.

I created the following Macro;

Sub Macro1()
Range("A3:D10").Select
Selection.Sort Key1:=Range("A3"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

Now what should I do in VBA to auto start the Macro1 whenever a change occurs?
Should I put the VBA codes in the Worksheet or in a module?

Thank you kindly
Related:

1 response

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Nov 25, 2009 at 05:54 AM
"cahnge occuirs " whre in column A or in all the columns.
you have to make an event code something like this

Private Sub Worksheet_Change(ByVal Target As Range)
<here you fix the target locations and then in next lilne write Macro1>
End Sub
0