+ Reply to Thread
Results 1 to 19 of 19

Link data with a loop

  1. #1
    Registered User
    Join Date
    06-03-2014
    MS-Off Ver
    2007
    Posts
    87

    Link data with a loop

    Hi,

    I have a workbook with two sheets. One contains raw data without any formatting. I'm trying to link the cells in "Raw Data" sheet to my "Clean Data" sheet.

    The data are financial results by divisions and each division by year. So my goal is to do a loop 'Do until or 'Do while by the years to separate the divisions. My years go from 2008 to 2013 repeating itself for each divisions. Doing that way, when I add a year in my "Raw Data" sheet and re-run my code it will add the 2014 financial results to the "Clean Data" sheet.

    I hope that for some it is an obvious answer. I'm not so bad in VBA but for some reasons, I have no imagination at all when it comes to looping... So, I am only asking for a code to get me started.

    Any help is appreciated.

    Thank you

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Link data with a loop

    Hi Simba,

    Can you post a sample sheet??
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    06-03-2014
    MS-Off Ver
    2007
    Posts
    87

    Re: Link data with a loop

    Hi xladept! I have attached a sample and changed all numbers in it.

    Thank you.
    Attached Files Attached Files

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Link data with a loop

    Hi Simba,

    I may have something for you tomorrow.

  5. #5
    Registered User
    Join Date
    06-03-2014
    MS-Off Ver
    2007
    Posts
    87

    Re: Link data with a loop

    Thank you, I'm looking forward to that.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Link data with a loop

    Hi Simba,

    Do you want all the companies on the raw sheet to be represented on the clean sheet?

  7. #7
    Registered User
    Join Date
    06-03-2014
    MS-Off Ver
    2007
    Posts
    87

    Re: Link data with a loop

    Hi xladept,

    Yes that would be great, if possible.

    Thank you

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Link data with a loop

    I decided that the best thing to do was to build a clean data sheet from scratch - maybe tomorrow

  9. #9
    Registered User
    Join Date
    06-03-2014
    MS-Off Ver
    2007
    Posts
    87

    Re: Link data with a loop

    From scratch? Lot of time. Sure, whenever you can.

    Thanks.

  10. #10
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Link data with a loop

    Hi Simba,

    This relies on the integrity of the raw data sheet - I had to correct the sample - but with that in mind, try this:

    Deleted - Tomorrow another chance!
    Last edited by xladept; 06-12-2014 at 10:27 PM.

  11. #11
    Registered User
    Join Date
    06-03-2014
    MS-Off Ver
    2007
    Posts
    87

    Re: Link data with a loop

    Hi xladept,

    I had a chance to try it yesterday before you delete it. It works fine except that the raw sheet must be perfectly in place to do so. Other than that, it is great.

    Hope I'll be able to take a look at your new code today... if you have time. I wish I will be able to assist you the same way in the future if you need a code... And if doesn't require a loop of some sort ...

  12. #12
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Link data with a loop

    Hi Simba,

    I've done some extra formatting with this one - glad that you liked the first copy:

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    06-03-2014
    MS-Off Ver
    2007
    Posts
    87

    Re: Link data with a loop

    Unfortunately, I can't run this line :
    Please Login or Register  to view this content.
    Without this line it worked but the format and the years are just everywhere. So I replaced the line by :
    Please Login or Register  to view this content.
    But now, this line can't run :
    Please Login or Register  to view this content.
    If you could attached your file to see the differences that would help.

  14. #14
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Link data with a loop

    Hi Simba,

    I think this fixes it:

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    06-03-2014
    MS-Off Ver
    2007
    Posts
    87

    Re: Link data with a loop

    No, still have the same problem with the :
    Please Login or Register  to view this content.

  16. #16
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Link data with a loop

    SimbaX.xlsm - This works on my machine, try it and let me know - program is in Module4.

  17. #17
    Registered User
    Join Date
    06-03-2014
    MS-Off Ver
    2007
    Posts
    87

    Re: Link data with a loop

    It works with it. I'm sure it has do to with the presentation of the data.

    I'll try to breakdown the source of this glitch tomorrow. However, thank you xladept for your work! It is really appreciated.

  18. #18
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Link data with a loop

    You're welcome and thanks for the rep!

    Perhaps you could post a book where it fails?

    And, thanks for offering to help me with coding

  19. #19
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Link data with a loop

    Hi Simba,

    I jazzed up the code a little:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. loop through a range and open internet explorer where link is valid
    By papasmurfuo9 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-30-2014, 05:58 AM
  2. Update Workbook Link inside of a Do Loop? (code posted)
    By dch27 in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 09-25-2013, 12:16 PM
  3. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  4. Transpose horizontal data to vertical data with paste link
    By M.Devadhasan in forum Excel General
    Replies: 0
    Last Post: 07-07-2012, 01:01 PM
  5. Nested Loop Link
    By ashcrusher in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-12-2006, 11:46 PM

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