Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default auto sort macro

I am trying to use a macro to sort a table of data on worksheet 3, whenever I
update a value on worksheet 1 using Excel 2003 (Copy of macro below).
Although the macro picks up the change in data on sheet 1 and runs the sort
subroutine, nothing happens. I have discovered that by moving the tables to
sheet 1 and repointing the macro to the data that it does work and while this
is sufficient, I would like to know why the macro does not work when the
tables are on sheet 3.

Thank you for any advice anyone can provide

Private Sub Worksheet_Change(ByVal Target As Range)
If Not (Application.Intersect(Worksheets(1).Range("B4:U32 "), Target) Is
Nothing) Then
DoSort
End If
End Sub

Private Sub DoSort()
Worksheets(3).Range("A5:I10").Sort Key1:=Worksheets(3).Range("I5"),
Order1:=xlDescending, _
Key2:=Worksheets(3).Range("H5"), Order2:=xlDescending, Header:=xlYes
Worksheets(3).Range("A13:I18").Sort Key1:=Worksheets(3).Range("I13"),
Order1:=xlDescending, _
Key2:=Worksheets(3).Range("H13"), Order2:=xlDescending, Header:=xlYes
Worksheets(3).Range("A21:I27").Sort Key1:=Worksheets(3).Range("I21"),
Order1:=xlDescending, _
Key2:=Worksheets(3).Range("H21"), Order2:=xlDescending, Header:=xlYes
Worksheets(3).Range("A30:I36").Sort Key1:=Worksheets(3).Range("I30"),
Order1:=xlDescending, _
Key2:=Worksheets(3).Range("H30"), Order2:=xlDescending, Header:=xlYes
End Sub



 
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
Is there a way to Auto sort or save a sort? Barbie Excel Discussion (Misc queries) 11 December 1st 09 09:48 PM
Auto-Sort Won't Sort All Column Cells TikiTembo Excel Discussion (Misc queries) 1 March 25th 08 07:00 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Auto Sort using Macro Rubix Excel Worksheet Functions 3 November 13th 05 09:24 AM
Help:macro to auto sort data to different worksheets... 2nd Time Around Excel Discussion (Misc queries) 2 August 6th 05 12:31 PM


All times are GMT +1. The time now is 05:59 AM.

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

About Us

"It's about Microsoft Excel"