+ Reply to Thread
Results 1 to 7 of 7

Resolved >> Macro to edit multiple rows of text

Hybrid View

  1. #1
    Registered User
    Join Date
    10-22-2007
    Posts
    2

    Resolved >> Macro to edit multiple rows of text

    I used the macro editor to create a "simple" macro to edit 7 rows of text. The steps were basic and simple - F2 key, backspace about 25 times, and down arrow then repeat these 3 steps 6 more times. The macro I got gave me the result of the very first cell as I was recording the macro.

    I think I remember the old Lotus 1-2-3 macro text - {edit}{backspace}{down}. Wish it were still that simple.

    Anyone got any clues?

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    If the 7 cells are A1:A7, try this:
    Sub EditRows()
        Dim Cell As Range, Rng As Range
        Set Rng = Range("A1:A7")
        For Each Cell In Rng
            Cell = Left(Cell, Application.Max(0, Len(Cell) - 25))
        Next Cell
    End Sub
    You are simply using the Left function, same as you would as a formula. Also, you need to use the Max worksheet function, in order to avoid a negative number, which would create an error.

    HTH

    Jason

  3. #3
    Registered User
    Join Date
    10-22-2007
    Posts
    2
    Thanks Jason! I used to have a real good excel macro book but lost it in a fire a couple of years ago. Do you know any good titles?

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Walkenbach books always rate highly and come with demo discs. A cheaper option which is a bit older but still good is
    Microsoft Excel 97 Step by Step
    which you can get from amazon.

    or take a look at the below link for more advice

    Link may be useful.
    http://www.excelforum.com/showthread...highlight=book

    HTH

    VBA Noob
    Last edited by VBA Noob; 10-22-2007 at 04:44 PM.
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Quote Originally Posted by VBA Noob
    Hi,

    Walkenbach books always rate highly and come with demo discs.
    Definitely! I am actually a self-taught VBA user, with only the use of this forum and Walkenbach's Excel 2003 Power Programming with VBA.

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Just to add to jasoncw comment

    The Link below (useful links) has loads of links which is a great source of online info.

    VBA Noob

  7. #7
    Registered User
    Join Date
    02-17-2016
    Location
    Richmond, VA
    MS-Off Ver
    2013
    Posts
    1

    Re: Resolved >> Macro to edit multiple rows of text

    Perfect, thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1