Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default automatically sorting

does anyone know how to automatically sort in excel? if one column changes
how to link the entire rows together to automatically sort when the numbers
change? Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default automatically sorting

Hi Viki

If you put the code below into the worksheet module you wish to sort
automatically it should work for you, though it will use a sort key of
the column a you can change this easily enough by recording a macro
while you do the sort of sort you require.

Option Explicit
Dim LastRow As Integer
Dim LastCol As String
Dim MyCell As String
Private Sub Worksheet_Change(ByVal Target As Range)

LastRow = [A65535].End(xlUp).Row
LastCol = [A1].End(xlToRight).Address

If Len(LastCol) = 4 Then

MyCell = Mid(LastCol, 2, 1) & LastRow

Else

MyCell = Mid(LastCol, 2, 2) & LastRow

End If

Range("A1", MyCell).Sort Key1:=Range("A1"), Order1:=xlAscending,
Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End Sub


Hope this helps

Steve
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
Sorting Automatically paulas Excel Discussion (Misc queries) 3 April 27th 09 04:09 PM
sorting automatically abolbashari New Users to Excel 2 August 20th 08 09:10 PM
sorting range automatically lela2a Excel Discussion (Misc queries) 1 July 1st 08 08:46 PM
sorting automatically Mike Lemke Excel Worksheet Functions 2 October 31st 04 06:51 PM
Sorting data automatically scottwilsonx[_34_] Excel Programming 1 September 23rd 04 12:54 PM


All times are GMT +1. The time now is 07:32 PM.

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"