Closed Thread
Results 1 to 2 of 2

VBA to Insert Word, : and Hard Return

  1. #1
    Registered User
    Join Date
    07-27-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    19

    VBA to Insert Word, : and Hard Return

    Hi All,

    In column N i need to insert the word ‘Class’ in front of the a all numbers (there are lots of different numbers) that are in that column and ‘:’ after the number followed by a hard return, so goes from this –

    9 Swimming goggles; sunglasses; spectacles; eyewear; life-saving and teaching apparatus and instruments; swimmers and divers earplugs; nose clips; bathing floats; life buoys; life belts; breathing apparatus for underwater swimming. 18 Leather and imitations of leather, and goods made of these materials not included in other classes; animal skins, hides; trunks and travelling bags; umbrellas, parasols and walking sticks; bags; satchels; holdalls; wallets; purses; trunks; portfolios; attaché cases; briefcases; backpacks; gym bags; sports bags; tote bags; suitcases. 25 Clothing, footwear, headgear, swimwear.

    To this: (I can get it to this by using the find and replace feature)

    Class 9:
    Swimming goggles; sunglasses; spectacles; eyewear; life-saving and teaching apparatus and instruments; swimmers and divers earplugs; nose clips; bathing floats; life buoys; life belts; breathing apparatus for underwater swimming. Class 18:
    Leather and imitations of leather, and goods made of these materials not included in other classes; animal skins, hides; trunks and travelling bags; umbrellas, parasols and walking sticks; bags; satchels; holdalls; wallets; purses; trunks; portfolios; attaché cases; briefcases; backpacks; gym bags; sports bags; tote bags; suitcases. Class 25:
    Clothing, footwear, headgear, swimwear.


    But i need it like this:

    Class 9:
    Swimming goggles; sunglasses; spectacles; eyewear; life-saving and teaching apparatus and instruments; swimmers and divers earplugs; nose clips; bathing floats; life buoys; life belts; breathing apparatus for underwater swimming.
    Class 18:
    Leather and imitations of leather, and goods made of these materials not included in other classes; animal skins, hides; trunks and travelling bags; umbrellas, parasols and walking sticks; bags; satchels; holdalls; wallets; purses; trunks; portfolios; attaché cases; briefcases; backpacks; gym bags; sports bags; tote bags; suitcases.
    Class 25:
    Clothing, footwear, headgear, swimwear.


    The way i was doing this is by using find and replace for all the various different numbers, most of the numbers seem to follow with 3 or 4 spaces so i was quite easily able to isolate them and change them all except that I couldn’t manage to get the hard return to fall in the fight place

    I have been going through the sheet manually to get it straight at the moment which is a pain as the sheet is 2000 rows and i need to to the same to other sheets.

    There is also a slight problem in that some of the cells already contain the wording ‘Local Class (number)’ these need to stay as they are. (I’m not sure if this is a problem or not)

    Many thanks (im using Excel 2010)

    Jamie
    Attached Files Attached Files

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: VBA to Insert Word, : and Hard Return

    Welcome to the Forum, unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

Closed 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