Sort table using macro

S

Steve

Hello all,

I've only used these forums for a few days and have
already learned lots of valuable information - Thanks!

I have a table of 5 columns. I'd like to search by Column
3, then Column 2. At the moment, I cannot use the sort
function as Column 3 contains the MACROBUTTON fields and
the sort function does not work unless I display the field
codes. Column 3 is text, Column 2 is a number.

Now, because this document will be accessed by all
employees of the company, I don't want employees to have
to display field codes before they can sort the data.

The table has some merged columns at the top (where the
headings are). If this makes it too difficult, I can redo
the table to include the data only, with no merged cells.
Otherwise, I have to select the rows that I want to sort,
say row3 ---> last row, and sort from there.

What kind of code can I use to achieve this, if it is at
all possible with VBA? I have a very limited knowledge of
VBA but pick it up quite well. Any links or directions
would be much appreciated. I have searched these forums
and the web without much luck, other than a small amount
of info @ Microsoft's MSDN site.

Thanks in advance. Hopefully some day I'll be able to put
something back in to these forums!

Regards,

Steve.
 
W

Word Heretic

G'day "Steve" <[email protected]>,

Great name mate! Add a fake column to the end of the table, populate
it with the macrobuttons labels, use it instead of col 3 in your sort,
kill the superfluous col.


Steve said:
Hello all,

I've only used these forums for a few days and have
already learned lots of valuable information - Thanks!

I have a table of 5 columns. I'd like to search by Column
3, then Column 2. At the moment, I cannot use the sort
function as Column 3 contains the MACROBUTTON fields and
the sort function does not work unless I display the field
codes. Column 3 is text, Column 2 is a number.

Now, because this document will be accessed by all
employees of the company, I don't want employees to have
to display field codes before they can sort the data.

The table has some merged columns at the top (where the
headings are). If this makes it too difficult, I can redo
the table to include the data only, with no merged cells.
Otherwise, I have to select the rows that I want to sort,
say row3 ---> last row, and sort from there.

What kind of code can I use to achieve this, if it is at
all possible with VBA? I have a very limited knowledge of
VBA but pick it up quite well. Any links or directions
would be much appreciated. I have searched these forums
and the web without much luck, other than a small amount
of info @ Microsoft's MSDN site.

Thanks in advance. Hopefully some day I'll be able to put
something back in to these forums!

Regards,

Steve.

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top