A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Table : how to mix the data in column 1 ?



 
 
Thread Tools Display Modes
  #1  
Old September 15th, 2008, 08:00 PM posted to microsoft.public.word.tables
MoiMeme
external usenet poster
 
Posts: 17
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  
Old September 15th, 2008, 08:51 PM posted to microsoft.public.word.tables
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
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  
Old September 16th, 2008, 09:25 AM posted to microsoft.public.word.tables
Phil
external usenet poster
 
Posts: 606
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  
Old September 16th, 2008, 09:55 AM posted to microsoft.public.word.tables
Phil
external usenet poster
 
Posts: 606
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 !!!




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:33 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.