+ Reply to Thread
Results 1 to 9 of 9

Looping Through Employee IDs having overlapping Leave dates and Merging Selected Row Data

  1. #1
    Registered User
    Join Date
    03-16-2021
    Location
    Western Australia
    MS-Off Ver
    2013
    Posts
    4

    Looping Through Employee IDs having overlapping Leave dates and Merging Selected Row Data

    I have come across a problem that I have not been able to solve yet despite trying different ways for the last 2 days.
    I am looking to merge 2 or more row data for each Employee in the list where the rows to be merged are selected with CheckBoxes.
    I have added an example Workbook with dataset I have and the objective I wish to achieve. The approach I explored conforms looping within looping and I am going nowhere. Would someone be kind enough to guide me (or give an example) on how I can achieve the results shown in my example Workbook please?
    ProblemAndObjective.JPG
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,005

    Re: Looping Through Employee IDs having overlapping Leave dates and Merging Selected Row D

    Please Login or Register  to view this content.
    output on Sheet2: change highlighted to WS! to replace (overwrite) original
    Attached Files Attached Files
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Looping Through Employee IDs having overlapping Leave dates and Merging Selected Row D

    Another Option...
    Please Login or Register  to view this content.
    Last edited by sintek; 04-07-2022 at 08:46 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  4. #4
    Registered User
    Join Date
    03-16-2021
    Location
    Western Australia
    MS-Off Ver
    2013
    Posts
    4

    Re: Looping Through Employee IDs having overlapping Leave dates and Merging Selected Row D

    Hi John and Sintek, Thank you both for your prompt help. Your code worked as expected for the given scenario, but it could not merge 3 rows when I tested by checking 3 consecutive checkboxes for an employee. Also, it did not merge correctly when I checked non-consecutive rows to merge. I have attached workbook with the new scenario for your quick reference.
    Attached Files Attached Files

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Looping Through Employee IDs having overlapping Leave dates and Merging Selected Row D

    Please Login or Register  to view this content.
    Last edited by sintek; 04-08-2022 at 08:50 AM.

  6. #6
    Registered User
    Join Date
    03-16-2021
    Location
    Western Australia
    MS-Off Ver
    2013
    Posts
    4

    Re: Looping Through Employee IDs having overlapping Leave dates and Merging Selected Row D

    Hello sintek, I'm so grateful to you for your help. The revised code worked like a treat! I'm so happy. God bless you.
    Excelforum rocks!

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Looping Through Employee IDs having overlapping Leave dates and Merging Selected Row D

    Glad to have helped...Tx for rep +

  8. #8
    Registered User
    Join Date
    03-16-2021
    Location
    Western Australia
    MS-Off Ver
    2013
    Posts
    4

    Re: Looping Through Employee IDs having overlapping Leave dates and Merging Selected Row D

    Hello Sintek, I have a question re the line “With Cells(1, 3).CurrentRegion” - is there a way to specify the data range after finding the last row from Col C or I? CurrentRegion method will limit my ability to add further data/formula around the dataset. Thanks heaps.

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Looping Through Employee IDs having overlapping Leave dates and Merging Selected Row D

    CurrentRegion method will limit my ability to add further data/formula around the dataset.
    No it won't ...

    Add your data and test this...
    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. Combining Overlapping Dates between Unique ID & Identify Overlapping with Other Date Range
    By bihaequipinc in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 3
    Last Post: 09-28-2021, 02:11 AM
  2. [SOLVED] Merging two workbooks with overlapping data (zip codes)
    By DarrenPinn in forum Excel General
    Replies: 3
    Last Post: 08-17-2021, 08:54 PM
  3. Calculate Overlapping Leave for different categories
    By dineshiam in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-15-2020, 10:19 PM
  4. Tracking employee based on leave dates
    By sentinela in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-13-2020, 03:14 AM
  5. Replies: 5
    Last Post: 03-03-2015, 01:38 PM
  6. [SOLVED] Extract Leave dates for Employee with its type
    By rohit.r.p in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2013, 08:01 AM
  7. Display annual Leave Dates by employee
    By janger in forum Excel General
    Replies: 4
    Last Post: 01-14-2012, 07:05 AM

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