+ Reply to Thread
Results 1 to 5 of 5

Insert missing dates into a list of dates using vba

  1. #1
    Forum Contributor
    Join Date
    03-09-2012
    Location
    Isle of Man
    MS-Off Ver
    Excel 2010
    Posts
    118

    Insert missing dates into a list of dates using vba

    I have created a share price report using vba whereby column a has a list of dates and columns A, B, C, D etc have the price of stocks and shares on the date in column A. The dates on my report only come through for days where shares actually price.

    I have been asked to produce the same report but include weekends and holidays where shares did not price. This is easy to do manually but I'm stumped using vba.

    Basically I need every missing day to be included in the report and where the price cells are blank use the price from the previous day.

    I've attached a spreadsheet showing what I currently have on my report and what I need it to look like.

    Any help you could give me would be appreciated.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Insert missing dates into a list of dates using vba

    Copy your Data to Data sheet then run the FillBlank macro.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by JieJenn; 03-23-2015 at 12:18 PM.

  3. #3
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Insert missing dates into a list of dates using vba

    Ignore my last macro. Forgot we are using previous day instead of the next day. It's an early Monday...

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    03-09-2012
    Location
    Isle of Man
    MS-Off Ver
    Excel 2010
    Posts
    118

    Re: Insert missing dates into a list of dates using vba

    Thanks for your help JieJenn

    I'm afraid I get a debug error straight away with

    Dim wsData As Worksheet: Set wsData = ThisWorkbook.Worksheets("Data")

    Just to clarify: The data in my spreadsheet would just be the first batch of data. The second set of data is just for illustration purposes as to how I would want the first set of data to end up looking.

    I appreciate the help.

    Thanks

  5. #5
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Insert missing dates into a list of dates using vba

    You have the change Worksheets("Data") to your worksheet name. If your worksheet name is Stock, then you need to change Worksheets("Data") to Worksheets("Stock")

+ 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. Insert missing dates
    By jmiller7 in forum Excel General
    Replies: 7
    Last Post: 10-19-2014, 09:40 PM
  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. [SOLVED] Formula to find missing dates from a list of dates
    By PWinkz in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-22-2014, 08:11 AM
  4. Excel Macro to find missing dates and insert missing date as blank row
    By JevaMarie in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-26-2013, 11:08 AM
  5. [SOLVED] Insert Missing Dates
    By Sal1 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-07-2012, 01:25 AM

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