+ Reply to Thread
Results 1 to 4 of 4

VBA macro to insert row based upon set format

  1. #1
    Registered User
    Join Date
    09-03-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    30

    VBA macro to insert row based upon set format

    Hi,

    I'm having trouble writing a macro that will work in a number of spreadsheets that are at times not consistent in their formatting.

    I need the set repetition of the following:

    Date StartHour
    Date 6
    Date 7
    Date 8
    Date 9
    Date 10
    Date 11
    Date 12
    Date 13
    Date 14
    Date 15
    Date 16
    Date 17
    Date 18
    Date 19

    But unfortunately where there are complete gaps in a row of data it is ignored. Is there any vba code to search that this occurs and then insert a row with the correct date and time?

    Thanks for any help with this.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    09-03-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    30

    Re: VBA macro to insert row based upon set format

    Hi chaps,

    Any help on this would be most appreciated. I'm going to give it another go but I am not holding out much hope!

  3. #3
    Registered User
    Join Date
    09-03-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    30

    Re: VBA macro to insert row based upon set format

    Okay, I'm getting there.

    Please Login or Register  to view this content.
    This code works to insert the rows, however, I need to prevent it from adding a row where the above is 19 and the next is 6! Now I need to name the date and time correctly (columns A and B). The date needs to be the same as above where the StartHour above is <> 6 and the same as below if it is 6. The StartHour needs to be the above + 1 where the above is <> 19 where it should be 6!

    Thanks for any help.
    Last edited by hc91; 03-12-2015 at 04:54 AM.

  4. #4
    Registered User
    Join Date
    09-03-2014
    Location
    London
    MS-Off Ver
    2013
    Posts
    30

    Re: VBA macro to insert row based upon set format

    I'm sure this code is messy as anything but I just need to add the dates and times appropriately now!

    HTML Code: 

+ 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 Format/Insert/Send
    By JosueDG in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 08-06-2012, 12:25 AM
  2. Replies: 1
    Last Post: 01-27-2012, 05:54 PM
  3. Copy and insert rows with contents and format based on specific number
    By fatalcore in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-13-2012, 03:38 AM
  4. Insert Row macro to copy down Conditional Format & functions
    By Foxcan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-07-2009, 02:16 PM
  5. Insert Tab and format as Macro
    By sayasimpson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-14-2007, 03:16 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