+ Reply to Thread
Results 1 to 10 of 10

How do I insert a blank row if the previous row is not = to TODAY?

  1. #1
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Question How do I insert a blank row if the previous row is not = to TODAY?

    Howdy y'all,
    I have used this forum A LOT to gain the knowledge that I now have. I still have a lot to learn though. Anyhow, it's been a while since I've needed some help, but alas, here I am asking for help.

    I have a user form that when the update button is clicked, it places all the data on the next available row. What I'd like to do is...If the previous row in column A (date column) is not = to TODAY, then insert a blank row and then place the data in the row after the blank row. Basically, for every day change in the date column, add a blank row.

    Thank you in advance, and a BIG thanks to all those that have helped in the past!
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,624

    Re: How do I insert a blank row if the previous row is not = to TODAY?

    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Forum Contributor
    Join Date
    02-24-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: How do I insert a blank row if the previous row is not = to TODAY?

    something like this?

    Please Login or Register  to view this content.
    Not sure what you are doing, but this will get you there with maybe a little bit of modifying
    If I helped in any way, please click the star

  4. #4
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: How do I insert a blank row if the previous row is not = to TODAY?

    Thank you both. I have placed both of your codes (not at the same time) into my existing code and wasn't able to get either one to work yet. I will keep modifying and trying. If I cant figure it out, I will let y'all know. In the meantime, here is a before and after:
    Insert row if date not today.xlsx

    EDIT* IN the attached on the first sheet (BEFORE) is the result I'm getting. The 2nd sheet (AFTER) is the result I want. If the last rows date is not today, then insert a blank row after the last row and place the data after the blank row. If the date is today, then place the data in the next empty row. So, if all the dates are the same, they will be placed in continuous rows. If the date in the last row is different from today then add a blank row then place data after the blank row.

    Sorry, That explanation was a bit repetitious.
    Last edited by gmr4evr1; 10-03-2015 at 06:22 PM. Reason: Added more info.

  5. #5
    Forum Contributor
    Join Date
    02-24-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: How do I insert a blank row if the previous row is not = to TODAY?

    Since I don't know how your user form is laid out, I'm not sure I, or anyone can provide exactly what you need. So, here's my last attempt to give you something you can work with. Hope it helps. I also assumed that new entries would have a newer date than the previous row, hence the change in code to using "<"

    You will still need to modify it to suit your Userform, but it does what you describe. I tested it on your workbook.

    Please Login or Register  to view this content.
    Last edited by Jim885; 10-03-2015 at 07:39 PM.

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,624

    Re: How do I insert a blank row if the previous row is not = to TODAY?

    Please Login or Register  to view this content.
    Last edited by protonLeah; 10-03-2015 at 09:43 PM.

  7. #7
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: How do I insert a blank row if the previous row is not = to TODAY?

    Again, thank you both. I haven't been able to test these yet, and might not be able to for a couple of days. As soon as I try it out, I will let you know how it goes.

  8. #8
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How do I insert a blank row if the previous row is not = to TODAY?

    Where you currently have

    Please Login or Register  to view this content.
    use
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  9. #9
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: How do I insert a blank row if the previous row is not = to TODAY?

    Ok, I tried but failed epically. Below is the last code I tried (in red) along with the code for my userform. I tried different variations of each of the provided codes and was unable to get any of them to work properly. All of them still place the data on the very next row instead of skipping a row if the previous rows date is not today. The code highlighted in orange is another one that I tried to use.
    Please Login or Register  to view this content.
    Last edited by gmr4evr1; 10-12-2015 at 06:50 PM.

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: How do I insert a blank row if the previous row is not = to TODAY?

    Hi Tom

    It'll be something like this...you'll need to adapt the Code to your UserForm...
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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] Macro to insert a rage of cells deletes previous content if range is blank
    By 54ed in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-24-2014, 12:01 AM
  2. [SOLVED] Macro to insert a rage of cells deletes previous content if range is blank
    By 54ed in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-23-2014, 05:59 PM
  3. [SOLVED] Insert "=today()" into blank cell
    By Jim McEwan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2013, 12:27 PM
  4. [SOLVED] Find certain word, copy and paste cell in previous row if previous row is blank
    By steven_e in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2013, 12:53 PM
  5. [SOLVED] Find last previous non blank value and summarise previous 6 months
    By Lady_Shaz in forum Excel General
    Replies: 7
    Last Post: 12-11-2012, 06:20 AM
  6. Replies: 1
    Last Post: 04-30-2012, 06:02 AM
  7. 25 days previous to today?
    By MaQ in forum Excel General
    Replies: 5
    Last Post: 03-14-2006, 03:00 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