Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
SoNew2This SoNew2This is offline
external usenet poster
 
Posts: 4
Default Macro to Sort on Time

I work with a custom report writer that pulls data from a database onto a
report. One area of the report contains two columns with multiple rows. One
column is a time entry. The time entry can be 'out of order'.
Is there some sort of Macro that will select this table and sort the
contents on the first (time) column?
  #2   Report Post  
Posted to microsoft.public.word.tables
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Macro to Sort on Time

Assuming column 1, assuming the column has a header row, and assuming the
time is in a legitimate time format, the following will sort the times

With ActiveDocument.Tables(1).Columns(1)
.Sort ExcludeHeader:=True, _
SortFieldType:=wdSortFieldDate, _
SortOrder:=wdSortOrderAscending
End With

If there is no header row change the ExcludeHeader to False

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




SoNew2This wrote:
I work with a custom report writer that pulls data from a database
onto a report. One area of the report contains two columns with
multiple rows. One column is a time entry. The time entry can be 'out
of order'.
Is there some sort of Macro that will select this table and sort the
contents on the first (time) column?



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I sort the time of day in a tabe? Sue Tables 1 September 6th 06 10:45 PM
How do I sort the time of day in a tabe? Sue Tables 0 September 6th 06 09:57 PM
Macro to run at time of print... Chr1551 Microsoft Word Help 5 September 6th 05 05:21 AM
Macro Run-time Error '5941' raymond New Users 4 June 25th 05 12:02 AM
How do I create a macro to data sort in a table within a protecte. Keenly52 Tables 5 March 29th 05 08:38 AM


All times are GMT +1. The time now is 03:34 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"