(Msg. 1) Posted: Mon Sep 15, 2008 9:00 pm
Post subject: Table : how to mix the data in column 1 ? Archived from groups: microsoft>public>word>tables (more info?)
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
(Msg. 2) Posted: Tue Sep 16, 2008 3:04 am
Post subject: Re: Table : how to mix the data in column 1 ? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
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" <antispam.TakeThisOut@no.spam> wrote in message
news:etMH$U2FJHA.4784@TK2MSFTNGP05.phx.gbl...
> 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 !!!
>
(Msg. 3) Posted: Tue Sep 16, 2008 3:04 am
Post subject: Re: Table : how to mix the data in column 1 ? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
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" <antispam.RemoveThis@no.spam> wrote in message
> news:etMH$U2FJHA.4784@TK2MSFTNGP05.phx.gbl...
> > 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 !!!
> >
>
>
>
(Msg. 4) Posted: Tue Sep 16, 2008 3:04 am
Post subject: Re: Table : how to mix the data in column 1 ? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
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" <antispam.DeleteThis@no.spam> wrote in message
> > news:etMH$U2FJHA.4784@TK2MSFTNGP05.phx.gbl...
> > > 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 !!!
> > >
> >
> >
> >
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum