View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Derek Hart Derek Hart is offline
external usenet poster
 
Posts: 26
Default Macro To Sort By Column Header Names

Thank you for the response. What I was looking for was code to do this,
with examples as column names. I do know the column names that the sort
will be on. I wanted to see how this could be done in VBA, using specific
column names (referring to row 1). It would sort on Event, Key, State,
City, for example.


"Dave Peterson" wrote in message
...
If you do this manually, you have to sort the data twice because of the
limit of
3 keys in sorting.

Same thing in code. You have to do two sorts.

The easiest way to get code that works the way you want is to record a
macro
when you do those two sorts. It would be a guess for us to know what 4
columns
you want and what order to sort each column.

Derek Hart wrote:

If I want to sort by 4 columns, I know I can do that by hand, but I wish
to
do this in a macro, and use the column headers (row 1 always) to name the
columns to sort by. Possible to do in a macro. Example?


--

Dave Peterson