Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting - except for Total row

Status
Not open for further replies.

fbermudez

Technical User
Oct 22, 2003
14
0
0
US
I have a report that needs to be sorted by different columns depending on the end user.
I wrote a macro that shows the column name and a button so the end user can select the column they wish to sort on - Descending or Ascending Value

My problem is that I want to select everything between row 1 - the header row and row xxxx the total row to sort. row xxxx varies depending on when the report is run - so you can't hardcode the row number.

I ve tried:
Range("A2").Select -- selects 1st cell
Application.SendKeys "+^{end}" Ctrl+Shift+End Application.SendKeys "+{up}"to select the data range but it does not work

any ideas are greatly appreciated.
 
fbermudez,

Let me make a comment and a suggestion.

Totals at the BOTTOM of a table/report are, by and large, a vestage of the paper-and-pencil-adding-machine method of totaling and reconciling a column of figures.

With the advent of electronic spreadsheets, we can get
1) ACCURATE sums and
2) totals that can be placed ANYWHERE on the sheet/report.

The question I often ask is, "why make the customer (the user of the report) hunt for the MOST IMPORTANT PIECE OF INFORMATION -- the TOTAL, at the BOTTOM, when it could, for instance, be placed at the very TOP for ALL to see IMMEDIATELY!

I would place the TOTAL(s) in ROW 1, or there about, and the FIRST ROW OF TABLE HEADINGS 2 rows thereafter (i.e. with an EMPTY ROW in between the Total(s) and the Table), in order to INSULATE the Total(s) from the Table that you might want to sort or filter.

Solves all you problems EXCEPT for stubborn people that have to have it "the way we used to do it!"

:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top