+ Reply to Thread
Results 1 to 13 of 13

Macro for Moving Data

  1. #1
    Registered User
    Join Date
    09-01-2007
    Posts
    24

    Macro for Moving Data

    I am hoping some one can help me create a macro for my problem.
    I need to move a lot of data from what was originally a txt document into an easily readable form.
    I have used Macro's before but only for very basic routines (so please treat me as a bit dumb when it comes to Macro’s).
    I have Include Screen shot of the data highlighted in a colored box and the relevant colored cell I need to move it into.
    This needs to be repeated many times with data that is consistent in its layout.
    Thanks Gary
    Attached Images Attached Images

  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
    Hello Hawkmoon,

    It seems your post cropped some cells on the worksheet. It would be best to post the workbook. That way it is clear were your data is coming from, how it is formatted, and were it will go.

    Thanks,
    Leith Ross

  3. #3
    Registered User
    Join Date
    09-01-2007
    Posts
    24
    The rest of the work book is the same, Just different Values. But I will Post it any way. Thank you for your help Gary
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    09-01-2007
    Posts
    24
    The rest of the work book is the same, Just different Values. But I will Post it any way. Thank you for your help Gary

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You could probably use Split, but can you attach a zipped workbook with some sample data & layout?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    09-01-2007
    Posts
    24

    Zip File included

    Sorry guys I did not have any Zip utility I have installed one Hope you can fix my Problem.
    I do not Know what split is LOL
    Thanks Gary
    Attached Files Attached Files

  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
    Hello Hawkmoon,

    The macro here has been added to the attached workbook. You can use CTRL+Z as the shortcut to run it.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    09-01-2007
    Posts
    24

    Thank you Lieth

    Thank you very much Lieth, you have made life easier for me and my friends at work. I believe you did this in Visual Basics of which I know nothing about. Can it be done with a Macro ???
    Also Can I change the values for : -
    StartRow = 9
    LastRow = 138
    As the amount of weld files very.

    Thanks once again Gary

  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
    Hello Hawkmoon,

    Yes, you can change the values. Since you say the format is consistent I take that to mean the starting row will always be the same. If the number of files varies then the macro can find the last entry automatically. I have made the change in this version for you. Delete the old macro and replace it with this one. If you need help installing this new macro let me know.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  10. #10
    Registered User
    Join Date
    09-01-2007
    Posts
    24

    Than you again Leith

    Thank you again Leith, I realized I was being lazy asking you about the start and finish values. Why not try it my self?
    I did, on the full document the relevant Data starts around cell A230 and finishes around A383 depending on how many files there are.
    It still worked perfectly when I changed the start and finish values in VB editor.
    My biggest worry was do you save after altering the VB file or what?
    I think I tried 'close VB editor' and all worked well.

    As I said before you have made life easier for me and my friends at work.
    Checking these files will be so much easier from now on.
    But I would still like to know can you do this with a macro relating it to the relevant cells each time.
    Thanks Gary

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

    Whenever you save your workbook, any changes you have made with the VBE (Visual Basic Editor) are also saved. As for your last question "Can you do this with a macro relating it to the relevant cells each time?", I am not sure I understand what you want to do. If you can give me an example that would help.

    Thanks,
    Leith Ross

  12. #12
    Registered User
    Join Date
    09-01-2007
    Posts
    24

    Visual basics Beyond Me

    We have many different files like the one I showed you. All of which are not easy to read. They are the program files for a weld robot.
    What you did for me is great but it is beyond me to apply it to another file unless it is a simple modification.
    I would like to be able to do it with a macro.
    I believe you can get a macro to run working on relative cells.
    Thanks again Gary

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

    If you are asking whether this VBA macro can be rewritten using Excel formulae (macros), the answer would be no. Worksheet formula solutions can only take you so far. People seem to view these built-in functions as omnipotent. They are powerful, but they can't, nor should they be expected to, solve all programming challenges. This where VBA macros come in.

    If you post or email some copies of the files. I can better access what changes would need to be made to macro to satisfy your needs. Support for the macros that I write or that others write wouldn't really be a problem. You have taken the steps to request help with your challenges. This is one of the reasons the forum exists. My email address is LeithRoss@gmail.com

    Sincerely,
    Leith Ross

+ 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