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  

Random Sorting



 
 
Thread Tools Display Modes
  #1  
Old September 10th, 2004, 11:21 PM
KelliC
external usenet poster
 
Posts: n/a
Default Random Sorting

Is there any way to randomly sort text in Word 2003?
  #2  
Old September 10th, 2004, 11:43 PM
Greg Maxey
external usenet poster
 
Posts: n/a
Default

Found this in Google. Try:


Sub RandomWords()
Dim myArray() As String, myTemp As String
Dim Index As Long, OtherIndex As Long

If Selection.Type = wdSelectionIP Then
MsgBox "Please select some words"
Exit Sub
End If

myArray = Split(Selection.Text)
Randomize
For Index = 0 To UBound(myArray)
OtherIndex = Rnd * UBound(myArray)
myTemp = myArray(Index)
myArray(Index) = myArray(OtherIndex)
myArray(OtherIndex) = myTemp
Next Index

Selection.Text = Join(myArray)
End Sub

--
Greg Maxey
A peer in "peer to peer" support
Rockledge, FL
To e-mail, edit out the "w...spam" in

KelliC wrote:
Is there any way to randomly sort text in Word 2003?



  #3  
Old September 11th, 2004, 04:19 AM
Jezebel
external usenet poster
 
Posts: n/a
Default

Another method, that doesn't involve code and let's you experiment: copy the
text and paste into an Excel spreadsheet. Insert a column. Select an
arbitrary substring from each item of text eg =Mid(A1,6,4) to take 4
characters starting with the sixth. Sort on that column. Copy and paste back
into Word.



"KelliC" wrote in message
...
Is there any way to randomly sort text in Word 2003?



 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Random Number Generator Rich Worksheet Functions 4 August 17th, 2004 07:19 PM
Random Function in VB Jim Campbell New Users 10 August 8th, 2004 12:33 AM
random number generator formula Dave R. Worksheet Functions 1 October 7th, 2003 04:02 AM
Random Numbers L. Howard Kittle Worksheet Functions 1 September 18th, 2003 07:20 PM


All times are GMT +1. The time now is 06:49 PM.


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