Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sorting Automatically | Excel Discussion (Misc queries) | |||
sorting automatically | New Users to Excel | |||
sorting range automatically | Excel Discussion (Misc queries) | |||
sorting automatically | Excel Worksheet Functions | |||
Sorting data automatically | Excel Programming |