+ Reply to Thread
Results 1 to 9 of 9

Automating repeated copy/paste

  1. #1
    Registered User
    Join Date
    11-23-2009
    Location
    adelaide, australia
    MS-Off Ver
    Excel 2003
    Posts
    4

    Thumbs up Automating repeated copy/paste

    G'day,
    I've data in a sheet (case1) which I would like to paste in a new sheet (case2) in the shown format. Is there any easy way of automating this? I tried recording a macro & tried somehow to automate this task but gave up after a few tries? Any tips/help would be really appreciated.

    Cheers.
    Attached Files Attached Files
    Last edited by samab; 11-24-2009 at 03:27 AM. Reason: problem solved

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Automating repeated copy/paste

    Hello samab,

    Welcome to the Forum!

    It looks as though most of your cases are unique. I did find this one, CASE AA012104, which has 2 entries. Is each entry to be formatted as you have on the Case 2 worksheet?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    11-23-2009
    Location
    adelaide, australia
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Automating repeated copy/paste

    thanks mate...
    yeah all the entries were intended to be unique......i guess the alpha (9th) in col B entries somehow missed out during formatting....here is the workbook again with the correction...
    i would like each entry to be formatted as shown in "case2" as the intention is to save it as .txt file to be loaded in another software...
    Attached Files Attached Files

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Automating repeated copy/paste

    Hello samab,

    Well, still not all unique. Found this pair right off...
    CASE AA012104H 0 0.5 0.001 5698
    CASE AA012104H 0 0.5 0.001 8477

    I can have the macro choose one if there is some rule to the choice. That will save you the trouble of cleaning up the file again.

  5. #5
    Registered User
    Join Date
    11-23-2009
    Location
    adelaide, australia
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Automating repeated copy/paste

    sorry for the trouble mate....i guess all the entries (in col B) are unique in that their corresponding values in col F are different ...can this be applied as a rule??? if not the other option/rule would be that if the two entries in col B are same, choose the one which has the highest value in col F

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Automating repeated copy/paste

    Hello samab,

    I'll go with the first rule and see what the results are like. So far, it looks like it will work.

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Automating repeated copy/paste

    Hello samab,

    The data appears to be fine so I left out any checking for now. I added a button on sheet Case2 to run the macro below. Let me know how this works out. Here is the macro code.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-23-2009
    Location
    adelaide, australia
    MS-Off Ver
    Excel 2003
    Posts
    4

    Thumbs up Re: Automating repeated copy/paste

    crikey.....this is exactly wot i wanted mate.....macro works a treat..u r a legend!!!
    not urgent but if n when u get time i wud luv to c how the macro wud look if we were to go with the 2nd option/rule...

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Automating repeated copy/paste

    Hello samab,

    I can do that. I am going to get some rest and tackle that in the morning.

+ 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