Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
MoiMeme MoiMeme is offline
external usenet poster
 
Posts: 8
Default Table : how to mix the data in column 1 ?

Hi,

I have a table in Word 2002/XP
I want to mix the data in column 1 ( alphabetic only with , and

Is there a way to achieve that ? I do not want to sort but to mix randomly

TIA !!!


  #2   Report Post  
Posted to microsoft.public.word.tables
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Table : how to mix the data in column 1 ?

Running a macro containing the following code will sort the table in which
the selection is located in random order (assumes that row 1 is a header row
and is not included in the sort

Dim i As Long, j As Long
Dim atable As Table
Dim acol As Column
Set atable = Selection.Tables(1)
Set acol = atable.Columns.Add(BeforeColumn:=atable.Columns(1) )
i = atable.Rows.Count - 1
For j = 2 To i + 1
acol.Cells(j).Range.Text = (i * Rnd) + 1
Next
atable.SortAscending
atable.Columns(1).Delete


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"MoiMeme" wrote in message
...
Hi,

I have a table in Word 2002/XP
I want to mix the data in column 1 ( alphabetic only with , and

Is there a way to achieve that ? I do not want to sort but to mix randomly

TIA !!!



  #3   Report Post  
Posted to microsoft.public.word.tables
Phil Phil is offline
external usenet poster
 
Posts: 70
Default Table : how to mix the data in column 1 ?

Thanks a lot.
Works fine.
But my tables that i want to mix up do not contain a header row. So I want
row 1 mixed as well. Have tried to set j to 1 in the for j=2 to i+1, but that
doesn't work. Row 1 still sticks to row 1.
How should I proceed ?

Many thanks ! That was fast and well done.

"Doug Robbins - Word MVP" wrote:

Running a macro containing the following code will sort the table in which
the selection is located in random order (assumes that row 1 is a header row
and is not included in the sort

Dim i As Long, j As Long
Dim atable As Table
Dim acol As Column
Set atable = Selection.Tables(1)
Set acol = atable.Columns.Add(BeforeColumn:=atable.Columns(1) )
i = atable.Rows.Count - 1
For j = 2 To i + 1
acol.Cells(j).Range.Text = (i * Rnd) + 1
Next
atable.SortAscending
atable.Columns(1).Delete


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"MoiMeme" wrote in message
...
Hi,

I have a table in Word 2002/XP
I want to mix the data in column 1 ( alphabetic only with , and

Is there a way to achieve that ? I do not want to sort but to mix randomly

TIA !!!




  #4   Report Post  
Posted to microsoft.public.word.tables
Phil Phil is offline
external usenet poster
 
Posts: 70
Default Table : how to mix the data in column 1 ?

Hi,

have found out that I have to use Sort instead of SortAscending which
excludes row 1 from sort.
Now works as I wanted using simply aTable.Sort ( haven't used parameters
since get error when trying, and default behaviour works fine)

Thanks again for the hints !

"Phil" wrote:

Thanks a lot.
Works fine.
But my tables that i want to mix up do not contain a header row. So I want
row 1 mixed as well. Have tried to set j to 1 in the for j=2 to i+1, but that
doesn't work. Row 1 still sticks to row 1.
How should I proceed ?

Many thanks ! That was fast and well done.

"Doug Robbins - Word MVP" wrote:

Running a macro containing the following code will sort the table in which
the selection is located in random order (assumes that row 1 is a header row
and is not included in the sort

Dim i As Long, j As Long
Dim atable As Table
Dim acol As Column
Set atable = Selection.Tables(1)
Set acol = atable.Columns.Add(BeforeColumn:=atable.Columns(1) )
i = atable.Rows.Count - 1
For j = 2 To i + 1
acol.Cells(j).Range.Text = (i * Rnd) + 1
Next
atable.SortAscending
atable.Columns(1).Delete


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"MoiMeme" wrote in message
...
Hi,

I have a table in Word 2002/XP
I want to mix the data in column 1 ( alphabetic only with , and

Is there a way to achieve that ? I do not want to sort but to mix randomly

TIA !!!




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
Put table at top of second newspaper column after column break Chris Tables 20 February 25th 08 11:19 AM
How can I swap all the table data in column #5 so it replaces col Me Tables 1 July 25th 06 05:49 PM
Column Breaks for Illustrations in 2 Column Table Karanja Tables 1 June 13th 06 11:45 PM
In a Table, How can I multiple column 1&3 to place in column 4 Marine Tables 1 December 3rd 05 06:45 PM
How to paste a column of text into a column in a Word Table Sam Page Layout 2 July 31st 05 08:03 PM


All times are GMT +1. The time now is 06:24 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"