+ Reply to Thread
Results 1 to 4 of 4

Macro to insert copy of row if Open dates are less than Closed dates - delete rows in betw

  1. #1
    Registered User
    Join Date
    03-28-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 365
    Posts
    79

    Macro to insert copy of row if Open dates are less than Closed dates - delete rows in betw

    I apologise for creating a new thread. AlphaFrog helped create a macro for my previous post. I have been asked to delete rows that are between the Maintanance rows. After the copy of the Maintanance row has been inserted, the 'Ticket Open' dates for the next rows are less than 'Ticket Closed' should be deleted.

    Example

    Maintanance row and dates found
    next row with dates less than Maintanance row date
    next row with dates less than Maintanance row date
    next row with dates less than Maintanance row date
    Insert copy of Maintanance row coz the next row dates are not less than Maintanance row dates

    THEN DELETE THE 'next row with dates less than Maintanance row date' rows

    The current macro processes are;

    1. if value in column I is 'Maintanance', (n.b. we will call row the 'Maintanance row) then check if the 'Ticket Open' dates for the next rows are less than 'Ticket Closed' for the 'Maintanance' row
    2. Insert a copy of the 'Maintanance row after the last row whose 'Ticket Open' is less than the 'Ticket Closed' for the 'Maintanance' row
    3. 'Ticket Open' and 'Ticket Closed' for the inserted row should be the same as the 'Ticket Closed' for the 'Maintanance' row
    4. then look for the next Maintanance row in column I and repeat same procedure


    I have attached the file with row I had to insert manually after a macro I created failed. The original file has more than 500 Maintanance rows.

    The Maintanance row is in row 6. I inserted a copy of the 'Maintanance' row in row 10.
    HTML Code: 
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Macro to insert copy of row if Open dates are less than Closed dates - delete rows in

    You should have posted this follow up in the original thread. I would have been automatically notified.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    03-28-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 365
    Posts
    79

    Re: Macro to insert copy of row if Open dates are less than Closed dates - delete rows in



    Thank you so much

  4. #4
    Registered User
    Join Date
    03-28-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 365
    Posts
    79

    Re: Macro to insert copy of row if Open dates are less than Closed dates - delete rows in

    The code does not loop. After the first process is complete it should find the next 'Maintanance' and repeat the process.
    Attached Files Attached Files

+ 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. Macro to insert copy of row if Open dates are less than Closed dates
    By bongielondy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2019, 02:50 AM
  2. [SOLVED] Macro that can grab dates within a parameterized list and insert rows with those dates
    By UMBiii in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-12-2014, 09:14 AM
  3. Detecting where to Insert, Delete, or Rearrange Rows using Values and Dates
    By StudentTeacher in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-28-2012, 01:02 PM
  4. Need a formula to calculate time between open and closed dates and times
    By DebbieF in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-03-2012, 02:45 AM
  5. VBA/Macro to delete rows based on comparing two dates?
    By tltlk678 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-26-2012, 02:25 AM
  6. [SOLVED] HOW TO FIND DIFF. BETW. 2 DATES, IT SHOULD BE IN YRS, MONTH & DAY
    By Eamon in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 06:05 AM
  7. HOW TO FIND DIFF. BETW. 2 DATES, IT SHOULD BE IN YRS, MONTH & DAY
    By Mushtaq Ahmed .T in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 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