+ Reply to Thread
Results 1 to 10 of 10

Insert Row into the range under specific condition

  1. #1
    Registered User
    Join Date
    06-27-2018
    Location
    Azerbaijan
    MS-Off Ver
    2013
    Posts
    29

    Insert Row into the range under specific condition

    Hello, Dear Members!

    I kindly ask you help me on this issue. Please find attached file.

    Here you will find Workers and their working years. I need to add new line for worker when his/her working year finished. For example when the date > 17.07.2018 I need to add new line for John. (date = today formula)

    It look like simple but this is a part of my vacation module.

    I started to write code like this and when I run it I got compile error for "MyTable". I can't find out issue.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Medex; 06-30-2018 at 04:09 AM.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Insert Row into the range under specific condition

    Here is how I would do that:

    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 06-27-2018 at 10:45 AM.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    06-27-2018
    Location
    Azerbaijan
    MS-Off Ver
    2013
    Posts
    29

    Re: Insert Row into the range under specific condition

    Quote Originally Posted by Bernie Deitrick View Post
    Here is how I would do that:

    Please Login or Register  to view this content.
    Bernie Deitrick, Thanks a lot for your solution. I really appreciated.
    The good totally work well for standard range of data, but I have table for the data.
    How can I adjust your code for Table style?

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Insert Row into the range under specific condition

    The easiest thing to do (for me, at least )is convert your table to a range, run the macro, and convert the range back to a table.

  5. #5
    Registered User
    Join Date
    06-27-2018
    Location
    Azerbaijan
    MS-Off Ver
    2013
    Posts
    29

    Re: Insert Row into the range under specific condition

    Actually I can not do this thing within the total vacation module but again thanks for all our effort. I am grateful.

  6. #6
    Registered User
    Join Date
    06-21-2018
    Location
    Calgary, AB
    MS-Off Ver
    2013
    Posts
    94

    Re: Insert Row into the range under specific condition

    Just out of curiousity, why can you not do it?

  7. #7
    Registered User
    Join Date
    06-27-2018
    Location
    Azerbaijan
    MS-Off Ver
    2013
    Posts
    29

    Re: Insert Row into the range under specific condition

    Because this operation has to be made manually, but I try to do all things automatically as I can.

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

    Re: Insert Row into the range under specific condition

    Hi Medex

    In future please view the forum rules before posting. Your post does not comply with rule #3.
    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing.
    So, do the following:
    Edit your post, highlight your code and click the [#] button at the top of the post window.


    With that been said...Try this method...tests fine...
    Please Login or Register  to view this content.
    Last edited by sintek; 06-28-2018 at 04:41 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!!!

  9. #9
    Registered User
    Join Date
    06-27-2018
    Location
    Azerbaijan
    MS-Off Ver
    2013
    Posts
    29

    Re: Insert Row into the range under specific condition

    Dear Sintek,

    Thanks for all information, I did what I have to do.

    I appreciate your help.

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

    Re: Insert Row into the range under specific condition

    ............................................
    Thanks.gif
    Last edited by sintek; 07-02-2018 at 06:49 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. VBA to Insert Rows if Specific Condition is met.
    By DAN0127 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-29-2016, 05:06 PM
  2. copying specific range from one workbook to another in specific range based on condition
    By ankitgoyalhsr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-16-2015, 03:46 AM
  3. Need formula using 'If' condition & inserting a specific range.
    By andyzz in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-26-2014, 02:58 AM
  4. vba code to insert blank row after specific condition is met
    By archies.gall in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-24-2014, 05:07 AM
  5. Macro to delete specific range in a row with condition
    By abareesh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-24-2013, 10:12 AM
  6. Copy specific range when a condition is met
    By nikenis in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-04-2012, 02:25 AM
  7. Deleting Specific Range of Cells via Condition
    By Excel Newbie05 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 02-06-2008, 04:44 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