+ Reply to Thread
Results 1 to 5 of 5

Bring data split between rows into one row (have one row per record)

  1. #1
    Registered User
    Join Date
    08-19-2015
    Location
    Toronto, Canada
    MS-Off Ver
    Microsoft 365
    Posts
    19

    Bring data split between rows into one row (have one row per record)

    Hello All,

    This probably needs some sort of VBA code - and I am not up speed with VBA! Here's the situation:

    (1) Workbook has many worksheets
    (2) Each worksheet contains employee records for a specific company - unfortunately each employee record is split between 2 or more adjacent rows rather than being fully on one row
    (3) I need to pull data from all worksheets (companies) onto one main tab and have each employee record on one row (from pt 2 above right now data for each employee is split between 2 or more rows)

    I attach a small sample Excel file showing 2 worksheets and the main tab where data needs to be populated - with some explanatory notes. All employee names and details in the sample file are fictitious - I guarantee!

    Please if you guys could guide me on how I can achieve this - in reality I have at least 20 workbooks and each workbook contains at least 20 worksheets and each worksheet may have 100s of employee records split between rows.

    Thanks so much all.

    Yusuf
    Attached Files Attached Files

  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: Bring data split between rows into one row (have one row per record)

    This works on your sample:

    Please Login or Register  to view this content.
    Last edited by xladept; 04-06-2019 at 07:33 PM.
    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
    08-19-2015
    Location
    Toronto, Canada
    MS-Off Ver
    Microsoft 365
    Posts
    19

    Re: Bring data split between rows into one row (have one row per record)

    Hi Orrin,

    Fantastic! The code works wonderfully - dried up many tears of despair. Thank you so much!

    Just for my learning - have a couple of questions on the coding:

    1. At the start of the sub, you initially assign r = 3 - what would be the logic behind using 3 as starting value - can this be any number of my choice or is this somehow tied into the column B:B and "Spouse"?

    2. Towards end of the sub, you have "If Not F Is Nothing And F.Row > r + 1 Then GoTo OrgDo". What is the logic for using "And F.Row > r +1"? How would this stop code from going to OrgDo each time?

    Once again your help is much appreciated.

    Best,

    Yusuf

  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: Bring data split between rows into one row (have one row per record)

    Hi Yusuf,

    That r=3 means nothing, it's a remnant from an earlier version before I decided to use the finder.

    The finder in FindNext mode will go back to the start of data and repeat without that constraint.

    You're welcome and thanks for the rep!

    Orrin

  5. #5
    Registered User
    Join Date
    08-19-2015
    Location
    Toronto, Canada
    MS-Off Ver
    Microsoft 365
    Posts
    19

    Re: Bring data split between rows into one row (have one row per record)

    Okay - will remove from code. You are welcome - really this has saved me hours of agony!
    Last edited by excel_msa; 04-07-2019 at 11:08 AM.

+ 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. VLOOKUP to bring back 4th record down
    By Ramzes in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-01-2018, 11:20 AM
  2. [SOLVED] VBA to split record as newworkbook which is having more than 20000 rows
    By johnmacpro in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-21-2016, 05:25 AM
  3. [SOLVED] How to seperate and bring down data to the rows below
    By Philangr8 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-20-2016, 08:21 PM
  4. Replies: 1
    Last Post: 05-17-2016, 12:02 PM
  5. Need Macro code to split data split in 7 sheets based on variable rows in column A
    By Alija_21 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-31-2015, 08:03 AM
  6. bring a selected record into a form
    By ntambomvu in forum Excel General
    Replies: 5
    Last Post: 06-27-2015, 09:12 AM
  7. one record split into 3 rows --> Need the 3 rows rolled up into one record
    By bcn1988 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-26-2013, 04:26 PM

Tags for this Thread

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