Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Sort by Alpha, ignore blanks

I have this code, but realize that the blanks are sorted to the top
How can I prevent this. They need to stay at the bottom
I need the blanks, to add rows of names in the future.
After each new name is entered, it should rearrange the data in the cells
specified in alphabetical order of the names.

Sub Alpha()
ActiveWindow.LargeScroll ToRight:=3
Range("AS2:DS100").Select
ActiveWindow.ScrollRow = 1
Selection.Sort Key1:=Range("AS2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
ActiveWindow.SmallScroll ToRight:=-3
ActiveWindow.ScrollColumn = 1
Range("C8").Select
End Sub

Thank you for any suggestions
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Sort by Alpha, ignore blanks

Depending on how new information is entered, one possible solution
would be to sort only the range containing data.

Sub Alpha()
Range(Range("AS2:DS2"), Range("AS2:DS2").End(xlDown)).Sort _
Key1:=Range("AS2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub


--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I have this code, but realize that the blanks are sorted to the top
How can I prevent this. They need to stay at the bottom
I need the blanks, to add rows of names in the future.
After each new name is entered, it should rearrange the data in the cells
specified in alphabetical order of the names.

Sub Alpha()
ActiveWindow.LargeScroll ToRight:=3
Range("AS2:DS100").Select
ActiveWindow.ScrollRow = 1
Selection.Sort Key1:=Range("AS2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
ActiveWindow.SmallScroll ToRight:=-3
ActiveWindow.ScrollColumn = 1
Range("C8").Select
End Sub

Thank you for any suggestions

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Sort by Alpha, ignore blanks

Thank you Tushar,
changed the range from AS2:DS2 to AS2:AS100 and its working like a charm.

"Tushar Mehta" wrote:

Depending on how new information is entered, one possible solution
would be to sort only the range containing data.

Sub Alpha()
Range(Range("AS2:DS2"), Range("AS2:DS2").End(xlDown)).Sort _
Key1:=Range("AS2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub


--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I have this code, but realize that the blanks are sorted to the top
How can I prevent this. They need to stay at the bottom
I need the blanks, to add rows of names in the future.
After each new name is entered, it should rearrange the data in the cells
specified in alphabetical order of the names.

Sub Alpha()
ActiveWindow.LargeScroll ToRight:=3
Range("AS2:DS100").Select
ActiveWindow.ScrollRow = 1
Selection.Sort Key1:=Range("AS2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
ActiveWindow.SmallScroll ToRight:=-3
ActiveWindow.ScrollColumn = 1
Range("C8").Select
End Sub

Thank you for any suggestions


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Sort by Alpha, ignore blanks

"ufo_pilot" wrote in message
...
I have this code, but realize that the blanks are sorted to the top
How can I prevent this. They need to stay at the bottom
I need the blanks, to add rows of names in the future.
After each new name is entered, it should rearrange the data in the cells
specified in alphabetical order of the names.

Sub Alpha()
ActiveWindow.LargeScroll ToRight:=3
Range("AS2:DS100").Select
ActiveWindow.ScrollRow = 1
Selection.Sort Key1:=Range("AS2"), Order1:=xlAscending,

Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
ActiveWindow.SmallScroll ToRight:=-3
ActiveWindow.ScrollColumn = 1
Range("C8").Select
End Sub

Thank you for any suggestions


Better would be to write your own sort code, the performance will be better.
See http://www.standards.com/index.html?Sorting for a demo that shows how
easy it is to improve on Excel's sort.
Code is included for several sorting algorithms.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Sort by Alpha, ignore blanks

You are welcome. Glad to be of help.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Thank you Tushar,
changed the range from AS2:DS2 to AS2:AS100 and its working like a charm.

{snip}
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
Median - Ignore blanks jhicsupt Excel Discussion (Misc queries) 5 April 30th 23 03:43 AM
Ignore Blanks SEF Excel Discussion (Misc queries) 2 April 27th 10 08:10 PM
How do I sort alpha neumeric fields that have an alpha suffix? Bob Sparks Excel Worksheet Functions 3 May 31st 09 05:17 AM
USING IGNORE BLANKS IN FORMULA Roger H. Excel Discussion (Misc queries) 5 April 6th 05 05:01 PM
Ignore Blanks Todd Excel Programming 3 September 23rd 04 11:48 AM


All times are GMT +1. The time now is 06:21 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"