+ Reply to Thread
Results 1 to 4 of 4

Move cell contents from rows into specific columns

  1. #1
    Registered User
    Join Date
    08-21-2007
    Posts
    90

    Move cell contents from rows into specific columns

    I can only get the attached XLS in a "report" layout from a database, there are reasons it will not be furnished in any other format- it is for 4,000 records- 32,000 rows and we get an updated version monthly, so reformatting it manually to 1 row per record is a chore.


    It basically is an XLS that repeats every 8 rows (each 8 rows is for 1 record and the layout is the exact same every 8 rows)
    but some cells contain "field names" and some cells contain "data"
    one row has the "field name" in the cell immediately above the "data'
    and the other 7 rows have the "field name" and "data" in adjoining cells on the same row

    I would like to create an xls with the "field names" as column headings and have just 1 row per record with just the "data" in those cells.

    The attached XLS has 3 records-- I used Bold black text for "field name" and highlighted the "data" cells in yellow.... I used red text to show the first row of the next record.

    I have some experience with macros and VBA, and understand what needs to be done, but do not know how to get it repeat

    Please point me in the right direction.

    Thanks,

    JW
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: Move cell contents from rows into specific columns

    Hello JW

    I have some experience with macros and VBA, and understand what needs to be done, but do not know how to get it repeat
    I have taken you at your word and havent put much actual functional code into the macro in the attached file.

    There are many options for processing the input file, I have just taken a very simple approach to demonstrate the principles (I might consider arrays as a means of storing the fields instead of individual variables, not much difference except maybe less lines of code)

    Happy to help further if you get stuck

    jmac

    JWsample macro.xlsm

  3. #3
    Registered User
    Join Date
    08-21-2007
    Posts
    90

    Re: Move cell contents from rows into specific columns

    jmac1947: thanks for the push in the right direction.

    Thanks

  4. #4
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: Move cell contents from rows into specific columns

    Hi JW,
    you are welcome, as I said, happy to help further if you get stuck

    Cheers

    Jmac1947

    1. Please consider clicking on the * Add Reputation if you think this post has helped you
    2. Mark your thread as SOLVED when question is resolved

+ 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. [SOLVED] move cell contents over two columns when certain text in another column
    By hopefulhart in forum Excel General
    Replies: 7
    Last Post: 10-31-2013, 01:57 AM
  2. Move cell contents from rows to columns using color condition
    By Hoarky in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-18-2013, 05:12 AM
  3. Replies: 5
    Last Post: 02-10-2013, 07:59 AM
  4. Replies: 1
    Last Post: 08-06-2012, 10:49 AM
  5. Macro to move cell contents of multiple rows into one if criteria is met
    By citygov in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2012, 05:32 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