LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Macro Button to Sort Columns - Troubleshooting ideas?

Without seeing your data, try one of these

Sub sortrang()
Range(Range("a4"), Range("a4").End(xlDown).End(xlToRight)) _
..Sort Key1:=Range("A4"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

Sub sortusedrange()
Range("a4").CurrentRegion _
..Sort Key1:=Range("A4"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Munchkin" wrote in message
...
My worksheets has 500 rows / 8 columns & there is a Header Row. Column A
=
acct. number, Column B = Cutomer Name, Column C = Department, Column D =
Manager. I created marcos that sort specific columns with the click of a
button. When you sort by C or D, it works fine, but if you then try to
resort by account number Row 4 is excluded from the sort - even though my
macro includes it (see below) Any idea why?

Range("A4").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Sort Key1:=Range("A4"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A4").Select



 
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
button to seach columns for blank cells, then sort by two columns plfiredis Excel Programming 1 April 29th 08 02:32 PM
sort using forms button - cycle thru 9 columns mmadden2 Excel Programming 6 January 4th 08 08:23 AM
Button to sort a range, and sorting 12 columns [email protected] Excel Worksheet Functions 2 October 19th 06 04:14 AM
sort button,macro, or ? tiffky Excel Programming 3 August 28th 05 06:44 PM
Assign Macro to button in Excel doesnt work Any ideas? Mike@Becketts Excel Discussion (Misc queries) 2 December 20th 04 02:47 PM


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