PC Review


Reply
Thread Tools Rate Thread

automatically sorting

 
 
=?Utf-8?B?Vmlja2k=?=
Guest
Posts: n/a
 
      15th Nov 2007
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!
 
Reply With Quote
 
 
 
 
Incidental
Guest
Posts: n/a
 
      15th Nov 2007
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting Automatically paulas Microsoft Excel Misc 3 27th Apr 2009 04:09 PM
Sorting automatically to different tabs. jgaard Microsoft Excel Discussion 3 7th Dec 2008 01:15 PM
SQL automatically sorting =?Utf-8?B?QmVnaW5uZXI=?= Microsoft Access VBA Modules 6 26th Jun 2007 06:29 PM
Sorting Data Automatically Alan Bartley Microsoft Excel Misc 1 8th Dec 2004 01:51 PM
sorting automatically =?Utf-8?B?TWlrZSBMZW1rZQ==?= Microsoft Excel Worksheet Functions 2 31st Oct 2004 06:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:30 PM.