Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 74
Default Sort from Cell to End of Column

Good day,

I am looking for a formula or VBA Code to dynamically sort a range of cells
from Cell B2 down to the end of the Column regardless of length of data in
the column.

Thanks in advance for any ideas or suggestions.

Cordially,
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Sort from Cell to End of Column

Sub sortcoltoend()
Range("B1:B" & Cells(Rows.Count, "b").End(xlUp).Row). _
Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Brent E" wrote in message
...
Good day,

I am looking for a formula or VBA Code to dynamically sort a range of
cells
from Cell B2 down to the end of the Column regardless of length of data in
the column.

Thanks in advance for any ideas or suggestions.

Cordially,


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Sort from Cell to End of Column

Put the following worksheet event code in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
n = Cells(Rows.Count, "B").End(xlUp).Row
Set r = Range("B2:B" & n)
Set t = Target
If Intersect(r, t) Is Nothing Then Exit Sub
Application.EnableEvents = False
r.Sort Key1:=Range("B2")
Application.EnableEvents = True
End Sub

as you update column B, the re-sort occurs automatically.
--
Gary''s Student - gsnu200806


"Brent E" wrote:

Good day,

I am looking for a formula or VBA Code to dynamically sort a range of cells
from Cell B2 down to the end of the Column regardless of length of data in
the column.

Thanks in advance for any ideas or suggestions.

Cordially,

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 74
Default Sort from Cell to End of Column

Thanks guys. I'll give these a try.

"Don Guillett" wrote:

Sub sortcoltoend()
Range("B1:B" & Cells(Rows.Count, "b").End(xlUp).Row). _
Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Brent E" wrote in message
...
Good day,

I am looking for a formula or VBA Code to dynamically sort a range of
cells
from Cell B2 down to the end of the Column regardless of length of data in
the column.

Thanks in advance for any ideas or suggestions.

Cordially,



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
Two subjects: Column sort and True/False in cell dilynn17 Excel Worksheet Functions 3 May 3rd 08 02:45 PM
data, sort option is grayed. how to sort on a column? Steve Richter Excel Discussion (Misc queries) 1 September 25th 07 03:25 PM
how to sort column with cell pairs muggeschiss Excel Worksheet Functions 5 May 31st 07 01:41 PM
How can I sort a column by the last positions of each cell SHJOHN Excel Discussion (Misc queries) 2 September 11th 06 06:15 PM
Can you sort text in a column, but leave cell color alone? g wills New Users to Excel 4 December 3rd 04 10:42 AM


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

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"