+ Reply to Thread
Results 1 to 16 of 16

copy paste code correction

  1. #1
    Registered User
    Join Date
    11-14-2011
    Location
    Dusseldorf, Germany
    MS-Off Ver
    Excel 2003
    Posts
    97

    copy paste code correction

    Hello I need a code to locate a word from column C in column A and then copy-> paste colums B,C,D,E to the rows were these words were located.

    Please see attached an example file with a macro code that i'm using currently, the problem is that when working with a file of 100000 entries, this is very slow

    copy_paste_new.xlsm


    Need your help..
    Last edited by yiannis1925; 12-13-2011 at 12:11 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,454

    Re: copy paste code correction

    You could try the following code.

    Note that it uses columns AA and AB as temporary staorage for the contents of column A, without and with a leading space. Change range if necessary

    Regards, TMS


    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: copy paste code correction

    Another option. The 'acropole' and 'Acropole' - the same thing, right?
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    11-14-2011
    Location
    Dusseldorf, Germany
    MS-Off Ver
    Excel 2003
    Posts
    97

    Re: copy paste code correction

    Quote Originally Posted by nilem View Post
    Another option. The 'acropole' and 'Acropole' - the same thing, right?
    Simply magic! this works excellent!

  5. #5
    Registered User
    Join Date
    11-14-2011
    Location
    Dusseldorf, Germany
    MS-Off Ver
    Excel 2003
    Posts
    97

    Re: copy paste code correction

    Hello,

    I would like to make one change to that code if it is possible.

    When it is executed, I want to copy-paste to only the one that are blank... we can set the column B as a check point...

    so if the cell is blank there it should copy-paste there...
    if not, then it should do nothing with it.

    I hope it is easy to understand what I mean...

    Thank you in advance...

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: copy paste code correction

    try this
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    11-14-2011
    Location
    Dusseldorf, Germany
    MS-Off Ver
    Excel 2003
    Posts
    97

    Re: copy paste code correction

    Perfect! thank you

  8. #8
    Registered User
    Join Date
    11-14-2011
    Location
    Dusseldorf, Germany
    MS-Off Ver
    Excel 2003
    Posts
    97

    Re: copy paste code correction

    Hello,

    is it possible to make one change... ?

    The above code, searches for only one keyword... but if i have a phrase in column C this will not detect it.

    Please see an example attached! run the below code in it

    Please Login or Register  to view this content.
    Thank you for your help.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    11-14-2011
    Location
    Dusseldorf, Germany
    MS-Off Ver
    Excel 2003
    Posts
    97

    Re: copy paste code correction

    wrong file attached... here is the correct one
    Attached Files Attached Files

  10. #10
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: copy paste code correction

    see attachment
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    11-14-2011
    Location
    Dusseldorf, Germany
    MS-Off Ver
    Excel 2003
    Posts
    97

    Re: copy paste code correction

    excellent! thank you!

  12. #12
    Registered User
    Join Date
    11-14-2011
    Location
    Dusseldorf, Germany
    MS-Off Ver
    Excel 2003
    Posts
    97

    Re: copy paste code correction

    Hello,

    the problem that I see now, is that if I have a small word for example "niki" it will detect it in "Thessaloniki" ...

    so, with the old code we didn't had the above problem but if we had a phrase "hotels in thessaloniki" we couldn't detect it...
    and with the new one, we can detect a phrase but have the above problem

    is it possible to combine the two and have a perfect result ?

    thank you!

  13. #13
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: copy paste code correction

    maybe so (see attached file)
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    11-14-2011
    Location
    Dusseldorf, Germany
    MS-Off Ver
    Excel 2003
    Posts
    97

    Re: copy paste code correction

    Hello,

    I would like to know, if it is possible to make the code a little bit more advanced.
    In the attached file you will see an example...

    Thank you
    Attached Files Attached Files

  15. #15
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: copy paste code correction

    Hi, Yiannis. Check it out.
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    11-14-2011
    Location
    Dusseldorf, Germany
    MS-Off Ver
    Excel 2003
    Posts
    97

    Re: copy paste code correction

    I made a change in the code... from

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    because I need to check only for Negative Elements where B,C,D and E are with data.

    The problem is that now, if we have data only in B and C for some reason they are being deleted... see in attached file.
    Attached Files Attached Files

+ 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