LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 21
Default Automatic Sorting

I know this code automatically sorts a column in ascending order. But what
changes would you have to make to it to get it to sort a range of colums say
from A1 to F1 or maybe more?

Private Sub Worksheet_Change(ByVal Target As Range)
Dim whereIam As Range
Set whereIam = ActiveCell
If Intersect(Target, Range("B:B")) Is Nothing Then
Exit Sub
End If
Range("B1:" & Range("B1").End(xlDown).Address).Select
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending
'and back to where you started
whereIam.Select
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
automatic sorting in excel Gostal New Users to Excel 2 December 26th 06 08:35 PM
Automatic sorting in excel Gostal Excel Discussion (Misc queries) 2 December 21st 06 06:54 PM
Automatic sorting in Excel? john Excel Discussion (Misc queries) 3 December 21st 06 09:54 AM
automatic sorting gmisi Excel Worksheet Functions 3 October 11th 06 11:33 PM
Automatic Sorting????? Bigredno8 Excel Discussion (Misc queries) 3 May 28th 05 11:11 PM


All times are GMT +1. The time now is 08:50 PM.

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"