Re: Reversing a list - Back again!

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



OK - Plan B. Again assuming each line is a paragraph, the following macro
will reverse the list on a place by place basis. Select the list and run the
macro.

Sub ReverseList()
Dim oList As Variant
Dim sList As String
Set oList = Selection.Range
oList = Split(oList, Chr(13))
sList = ""
For i = UBound(oList) - 1 To 0 Step -1
If i = UBound(oList) - 1 Then
sList = oList(i)
Else
sList = sList & vbCr & oList(i)
End If
Next i
Selection.TypeText sList
End Sub

http://www.gmayor.com/installing_macro.htm

Your original list would now be

London Town (1946)
The Cardboard Cavalier (1949)
The Perfect Woman (1949)
Alf's Baby (1953)
Trouble in Store (1953)
The Malta Story (1953)
The Angel Who Pawned Her Harp (1954)
Man of the Moment (1955)
Ramsbottom Rides Again (1956)
Up in the World (1956)
A King in New York (1957)
Just My Luck (1957)
Follow a Star (1959)
Carry on Regardless (1961)
A Kind of Loving (1962)
A Stitch in Time (1963)
The Switch (1963)
Stolen Hours (1963)
The Beauty Jungle (1964)
Gonks Go Beat (1965)
The Early Bird (1965)

and your town list

Easington
Withernsea
Tunstall
Grimston
East Newton
Cowden
Mappleton
Hornsea
Atwick
Skipsea
Barmston
Wilsthorpe
Bridlington
Sewerby


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

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


SootJuggler wrote:
Hi - Back again

Unfortunately when I do a 'Paragraphs', 'Number', 'Descending' sort on
the list:

The Early Bird (1965)
Gonks Go Beat (1965)
The Beauty Jungle (1964)
Stolen Hours (1963)
The Switch (1963)
A Stitch in Time (1963)
A Kind of Loving (1962)
Carry on Regardless (1961)
Follow a Star (1959)
Just My Luck (1957)
A King in New York (1957)
Up in the World (1956)
Ramsbottom Rides Again (1956)
Man of the Moment (1955)
The Angel Who Pawned Her Harp (1954)
The Malta Story (1953)
Trouble in Store (1953)
Alf's Baby (1953)
The Perfect Woman (1949)
The Cardboard Cavalier (1949)
London Town (1946)

I get:

London Town (1946)
The Perfect Woman (1949)
The Cardboard Cavalier (1949)
The Malta Story (1953)
Trouble in Store (1953)
Alf's Baby (1953)
The Angel Who Pawned Her Harp (1954)
Man of the Moment (1955)
Up in the World (1956)
Ramsbottom Rides Again (1956)
Just My Luck (1957)
A King in New York (1957)
Follow a Star (1959)
Carry on Regardless (1961)
A Kind of Loving (1962)
Stolen Hours (1963)
The Switch (1963)
A Stitch in Time (1963)
The Beauty Jungle (1964)
The Early Bird (1965)
Gonks Go Beat (1965)

Which is ***NOT*** an exact reversal as same-year films do not
exchange relative places. The original list was already ordered,
what I want is the list reversing. You might say that that is not
terribly important in the case of a list of films. It might be
clearer if I give you as an example a sequence of a succession of
coastal settlements that do not have numbers in them as this shows
the importance of an exact reversal.

Sewerby
Bridlington
Wilsthorpe
Barmston
Skipsea
Atwick
Hornsea
Mappleton
Cowden
East Newton
Grimston
Tunstall
Withernsea
Easington

Can you invert this list. (Did somebody just say 'macro'?)


.



Relevant Pages

  • Re: Aperture - love it.
    ... >>> Tell me what aperture setting is optimal for a macro to maximize focus ... > maximum depth of field you stop the lens all the way down. ... This will approx triple your magnification. ... Go here and search for 'reverse' for a better explanation: ...
    (comp.sys.mac.advocacy)
  • Re: autonumbering
    ... Hmm, if you want to number text in a single sequence, you can use the macro ... Note that the macro keeps track of the sequence by storing the current value ... reverse the order starting from 1 at the bottom of the sheet and adding ... create a reverse numbering sequence. ...
    (microsoft.public.word.docmanagement)
  • Re: printing envelopes sith left side justification
    ... Do you have the text direction icons ("Left to right paragraph" and "Right ... the list of commands on the right, and drag it to your formatting toolbar. ... I see much the same as you do (except in reverse) but as long as my text ... the cursor is on the left; ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Macro to number blank cells
    ... Anne Troy (better known as Dreamboat) ... (Reverse it!) ... > I have a macro that inserts 6 rows below each name, ...
    (microsoft.public.excel)
  • Re: Button Problem
    ... Are you saying you have two macros -one to sub total the other to reverse it, if yes post your code as I suspect that may be the problem. ... When I push the button it kicks off the macro and subtotals the sheet. ...
    (microsoft.public.excel.programming)