+ Reply to Thread
Results 1 to 9 of 9

Populate Column with Row Data

  1. #1
    Registered User
    Join Date
    04-30-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    24

    Populate Column with Row Data

    I am receiving data in a report that looks like this:

    PHP Code: 
    Recipient        500420    NORTHERN AFFAIRS CDA
    Agreement        QC0400081    DSPNI 
    Amd    Initiated    Status    Recommendation
    1    2004.11.17    In Progress    Approved
    2    2005.03.02    In Progress    Approved
    3    2005.11.19    In Progress    Approved
    4    2006.02.23    In Progress    Approved
    5    2006.12.27    In Progress    Approved
    6    2007.11.28    In Progress    Approved
    7    2008.02.06    In Progress    Approved
    Recipient        500428    GAZETTE 
    Agreement        QC0900062    EFCPN 
    Amd    Initiated    Status    Recommendation
    1    2004.10.13    In Progress    Approved
    2    2005.02.23    In Progress    Approved 
    I would like to pull the agreement number and add it as a column for each amendment. I would also like to delete the 3 header lines. So at the end my data would look like this:

    PHP Code: 
    QC0400061    1    2004.11.17    In Progress    Approved
    QC0400081    2    2005.03.02    In Progress    Approved
    QC0400081    3    2005.11.19    In Progress    Approved
    QC0400081    4    2006.02.23    In Progress    Approved
    QC0400081    5    2006.12.27    In Progress    Approved
    QC0400081    6    2007.11.28    In Progress    Approved
    QC0400081    7    2008.02.06    In Progress    Approved
    QC0900062    1    2004.10.13    In Progress    Approved
    QC0900062    2    2005.02.23    In Progress    Approved 
    My agreement number is always in column "C" or will be in "D" if I add a new column. I seem to need to create Ranges that go from Row Recipient to Next Row Recipient, Populate "A" with Row + 1 "D" from Row Recipient + 3 to Row Next Recipent - 1. Then delete Row Recipient, Row Recipient + 1, Row Recipient + 2. Then Row Next Recipient becomes Row Recipient and I go find Row Next Recipient and start again till I reach end.

    Atleast that's what I think I need, but how to get write it is a little beyond my very basic VBA skills.

    Thanks in advance for any advice and help.
    Last edited by GDS; 05-12-2009 at 12:09 PM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Populate Column with Row Data

    Please can you attach a small sample workbook so we know exactly where everything is?

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Populate Column with Row Data

    Put this macro in a standard module and run it on a copy of your data, I think it does what you'd like. The macro is designed to run from A1 to the first EMPTY cell in column A and stop.
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    04-30-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Populate Column with Row Data

    StephenR

    Gladly

    Please see attached.
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Populate Column with Row Data

    I think JBeaucaire may already have solved your problem. What good service you get here.

  6. #6
    Registered User
    Join Date
    04-30-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Populate Column with Row Data

    JBeaucaire - I ran your code but nothing seems to happen. I think because "A" is not empty but has the Amd number in it (which is being seen as Text and not numeric).

  7. #7
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Populate Column with Row Data

    I ran it on your sample and it appeared to work. It definitely did something!

  8. #8
    Registered User
    Join Date
    04-30-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Populate Column with Row Data

    JBeaucaire - sorry it does work perfectly. I had two excel work sheets open and pasted the macro into the wrong worksheet.

    Thank you so much for your prompt response.

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Populate Column with Row Data

    Now that I've seen your data, the only thing I would add is ONE more line of code at the bottom:
    Please Login or Register  to view this content.
    Clean up the results appearance a little.
    Last edited by JBeaucaire; 05-12-2009 at 02:03 PM.

+ 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