+ Reply to Thread
Results 1 to 11 of 11

Macro Question: Copy a word from a column to another automaticly

  1. #1
    Registered User
    Join Date
    07-20-2008
    Location
    holland
    Posts
    8

    Macro Question: Copy a word from a column to another automaticly

    Hello,

    I am a noob at macro programming. I have a problem that maybe you could do in seconds. On the data sheet I attached you can see easily what I am trying to do:

    The macro should do something like this basically:

    Column A there is a entry like "L110E (CST_PRG-Wheel Loaders-E series models)"

    Lets say we have 10.000 entries more or less like this.

    Macro should do this:
    * Take first word for example in this case "L110E" and copy into column D same row.
    * Take second word's second part in this case only "PRG" and copy into column B same row.
    * Take the 3rd word between - - in this case only "Wheel Loaders" and copy into column C.

    That's all, please help me.

    Thanks.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    zaptiri

    Welcome to Exceltip forum

    Please take a couple of minutes and read the Forum Rules

    Your duplicate thread has been deleted
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    08-10-2007
    Posts
    51
    I don't have Excel 2007. Can you save it as an Excel 2003 fle so we can help? Not many of us have 2007 ... yet.

  4. #4
    Registered User
    Join Date
    08-10-2007
    Posts
    51
    Hi,

    Here is one solution assuming that the format of all your strings look similar with the dashes, the spaces, etc...

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-20-2008
    Location
    holland
    Posts
    8
    Hello here is the 2003 version, I haven't tried your solution yet, will do shortly.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-20-2008
    Location
    holland
    Posts
    8
    Quote Originally Posted by piyushdabomb
    Hi,

    Here is one solution assuming that the format of all your strings look similar with the dashes, the spaces, etc...

    Please Login or Register  to view this content.
    Your macro seemed to work on data file perfectly, but when I tried it on file with 10.000 entries it just did the first line and nothing else. What could be the problem?

  7. #7
    Registered User
    Join Date
    07-20-2008
    Location
    holland
    Posts
    8
    Quote Originally Posted by piyushdabomb
    Hi,

    Here is one solution assuming that the format of all your strings look similar with the dashes, the spaces, etc...

    Please Login or Register  to view this content.
    Ok I think I got the problem. I think there should be some addition to macro just in case the data is not a proper entry for example if data is not exact entry as we defined and for example it is like "sdfsdf sdfsdfsdfsdf" it gives error and cannot continue macro. In that case could you tell macro to leave it blank and move on to the next data. It seems on the big file the macro stops every 10 or so line and gives error because some data is not a proper entry.

  8. #8
    Registered User
    Join Date
    07-20-2008
    Location
    holland
    Posts
    8
    Can you please take a look at this data example you will understand what I mean:

    your macro works really good, just little bit adjustment is needed: try to use this table and see if you can do it.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    07-20-2008
    Location
    holland
    Posts
    8
    guys can you improve this macro little bit, piyushdabomb made a good work but it gives error if the data is an improper entry. How can I add a line that simply says "skip the row if there is an error and continue to next" instead of halting the whole macro?

    Thanks.

  10. #10
    Registered User
    Join Date
    08-10-2007
    Posts
    51
    Hi, I'm sorry if I missed you on this. I've been working on MANY MANY more crazier and higher priority items. Do you still need help?

  11. #11
    Registered User
    Join Date
    08-10-2007
    Posts
    51
    Anyway, here is the updated macro. It moves to the next item on the list if there is 'any' errors.

    Please Login or Register  to view this content.
    Last edited by VBA Noob; 11-12-2008 at 02:53 AM. Reason: Added code tags as per forum rules

+ 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