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.
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"
Application.SendKeys "+^{end}" Ctrl+Shift+End Application.SendKeys "+{up}"to select the data range but it does not work
any ideas are greatly appreciated.