+ Reply to Thread
Results 1 to 18 of 18

sequence Macro help

  1. #1
    Registered User
    Join Date
    10-13-2019
    Location
    Seattle,Wa
    MS-Off Ver
    Office 365
    Posts
    8

    sequence Macro help

    I am trying to figure out how to build a macro to spot missing sequence and add in a new row when found.

    There should be 1440 data points in column A
    The date and time formatting goes as followed

    10/10/2019 7:41
    10/10/2019 7:42
    10/10/2019 7:43
    10/10/2019 7:44
    10/10/2019 7:45
    10/10/2019 7:46
    10/10/2019 9:52
    10/10/2019 9:53
    10/10/2019 9:54
    10/10/2019 9:55
    10/10/2019 9:56

    I would like the macro to find that its missing the data between 7:47 and 9:51 and add in blank rows. The time is also in military time so the format is
    10/10/2019 00:00 thru 10/10/2019 23:59

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: sequence Macro help

    If the first two values are OK, then you can simply select them, put the mouse pointer on the node at bottom right of the selected area and drag down as far as needed. It will automatically fill in any missing increments.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: sequence Macro help

    Quote Originally Posted by JLGWhiz View Post
    If the first two values are OK, then you can simply select them, put the mouse pointer on the node at bottom right of the selected area and drag down as far as needed.
    I am just guessing here, but I think the problem with that approach may be that it does not keep data in other columns aligned with their respective time slots.

  4. #4
    Registered User
    Join Date
    10-13-2019
    Location
    Seattle,Wa
    MS-Off Ver
    Office 365
    Posts
    8

    Re: sequence Macro help

    Quote Originally Posted by Rick Rothstein View Post
    I am just guessing here, but I think the problem with that approach may be that it does not keep data in other columns aligned with their respective time slots.
    When attempting this it just adds more time slots based on the last number. does not open up blank rows.

  5. #5
    Registered User
    Join Date
    10-13-2019
    Location
    Seattle,Wa
    MS-Off Ver
    Office 365
    Posts
    8

    Re: sequence Macro help

    what I have found in the formatting of the date and time is that every entry, which is one min apart, is .0006944444 off of the next.

    I have tried using Kutools for this issue but it does not seem to work well for this.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: sequence Macro help

    Rule 03: Cross-posting Without Telling Us

    Your post does not comply with Rule 3 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Read this to understand why we ask you to do this.

    I have added the crosspost reference for you today. Please comply with this and all our rules in the future

    https://www.mrexcel.com/forum/excel-...blank-row.html
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  7. #7
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: sequence Macro help

    Assuming your data starts in cell A1, give this macro a try...
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-13-2019
    Location
    Seattle,Wa
    MS-Off Ver
    Office 365
    Posts
    8

    Re: sequence Macro help

    Quote Originally Posted by Rick Rothstein View Post
    Assuming your data starts in cell A1, give this macro a try...
    Please Login or Register  to view this content.
    You Sir are a life saver. worked like a charm. I have spent hours and hours trying to get that to work.
    Only question I have is my rows start at A4. Where do I adjust that in the macro?

  9. #9
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: sequence Macro help

    First off... did you read Message #6 yet? You will need to adhere to that in the future. Also, be nice and post the link back to this thread in your MrExcel thread there so that the volunteers there do not waste their time trying to solve your now solved problem.

    Here is the revised code for data starting in cell A4...
    Please Login or Register  to view this content.
    In the future, you should give us the relevant information like this so we don't have to go back and modify our solutions for you.

  10. #10
    Registered User
    Join Date
    10-13-2019
    Location
    Seattle,Wa
    MS-Off Ver
    Office 365
    Posts
    8

    Re: sequence Macro help

    Quote Originally Posted by Rick Rothstein View Post
    First off... did you read Message #6 yet? You will need to adhere to that in the future. Also, be nice and post the link back to this thread in your MrExcel thread there so that the volunteers there do not waste their time trying to solve your now solved problem.

    Here is the revised code for data starting in cell A4...
    Please Login or Register  to view this content.
    In the future, you should give us the relevant information like this so we don't have to go back and modify our solutions for you.
    Understood. My apologies.

    So with the macro the first time it worked great now after changing to A4 this is all it does
    10/10/2019 7:43
    10/10/2019 7:44
    10/10/2019 7:45
    10/10/2019 7:46
    10/10/2019 7:47 Added
    10/10/2019 7:48 Added
    10/10/2019 7:49 Added
    10/10/2019 7:50 Added
    10/10/2019 7:51 Added
    10/10/2019 9:52
    10/10/2019 9:53
    10/10/2019 9:54

    Any thoughts?

  11. #11
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: sequence Macro help

    Quote Originally Posted by googs91 View Post
    So with the macro the first time it worked great now after changing to A4 this is all it does
    10/10/2019 7:43
    10/10/2019 7:44
    10/10/2019 7:45
    10/10/2019 7:46
    10/10/2019 7:47 Added
    10/10/2019 7:48 Added
    10/10/2019 7:49 Added
    10/10/2019 7:50 Added
    10/10/2019 7:51 Added
    10/10/2019 9:52
    10/10/2019 9:53
    10/10/2019 9:54
    Isn't that what it is supposed to do? Your missing times were the ones you marked "Added" next to... what else was the code supposed to do?

  12. #12
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: sequence Macro help

    @googs91

    When you reply with Quote you are just adding clutter to the thread unless it is necessary to distinguish between posts provided by others. Simply click on reply.

  13. #13
    Registered User
    Join Date
    10-13-2019
    Location
    Seattle,Wa
    MS-Off Ver
    Office 365
    Posts
    8

    Re: sequence Macro help

    Quote Originally Posted by Rick Rothstein View Post
    Isn't that what it is supposed to do? Your missing times were the ones you marked "Added" next to... what else was the code supposed to do?
    its still missing about 1hr and 1 min of data

  14. #14
    Registered User
    Join Date
    10-13-2019
    Location
    Seattle,Wa
    MS-Off Ver
    Office 365
    Posts
    8

    Re: sequence Macro help

    alansidman

    Sorry guess im pretty new to forums.

  15. #15
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: sequence Macro help

    Quote Originally Posted by googs91 View Post
    its still missing about 1hr and 1 min of data
    Argh! I completely missed that!!! Give this code a try...
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    10-13-2019
    Location
    Seattle,Wa
    MS-Off Ver
    Office 365
    Posts
    8

    Re: sequence Macro help

    Works PERFECT thank you so much for your help. I will add this in my other post.

    Sorry about the miscommunication earlier.

  17. #17
    Registered User
    Join Date
    12-30-2017
    Location
    Baltimore, MD
    MS-Off Ver
    2013
    Posts
    2

    Re: sequence Macro help

    Hello I am wondering how the code would be modified to keep data in corresponding columns? For example, the first few rows of my data look like this:
    Time Pulse VVTI
    8/5/2019 9:09 109 11.24
    8/5/2019 9:14 85 11.28
    8/5/2019 9:24 80 11.16
    8/5/2019 9:30 88 11.17
    8/5/2019 9:33 112 10.77
    8/5/2019 9:35 72 11.65
    8/5/2019 9:39 77 11.43
    8/5/2019 9:47 78 11.26
    8/5/2019 9:49 85 11.11
    8/5/2019 9:52 86 11.18
    8/5/2019 9:54 88 10.96
    I need it like this for 1440 rows:
    8/5/2019 9:09 109 11.24
    8/5/2019 9:10
    8/5/2019 9:11
    8/5/2019 9:12
    8/5/2019 9:13
    8/5/2019 9:14 85 11.28
    Thank you, HeidiO

  18. #18
    Registered User
    Join Date
    12-30-2017
    Location
    Baltimore, MD
    MS-Off Ver
    2013
    Posts
    2

    Re: sequence Macro help

    Disregard my message please - I had copied the wrong code - the correct code DOES work like a charm. Thank you.

+ 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 for Number Sequence
    By Rj13 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-03-2019, 05:55 AM
  2. [SOLVED] Macro for numbering sequence
    By jackyung in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2019, 10:48 PM
  3. Creating a a single macro button to run multiple macro in sequence
    By aalbarak in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-12-2018, 05:46 AM
  4. Find a short-sequence in a longer sequence (Clash Royale Chests Challenge)
    By GeneralDisarray in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-08-2016, 12:20 PM
  5. Replies: 7
    Last Post: 06-08-2015, 08:39 AM
  6. Replies: 0
    Last Post: 12-12-2012, 06:39 PM
  7. Macro sequence number
    By onenessboy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-05-2012, 02:46 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