+ Reply to Thread
Results 1 to 3 of 3

Automatically delete columns after date has passed?

  1. #1
    Registered User
    Join Date
    02-16-2013
    Location
    Folsom, CA
    MS-Off Ver
    Excel 2010
    Posts
    47

    Automatically delete columns after date has passed?

    Hi, I have a simplified sample worksheet with columns of weekly dates (columns C through V) and several employees listed in the rows. The cells contain simple data about what day the employee is working that week or if not working at all (eg "MON", "TUE" or "X").

    I would like the worksheet to automatically update so that once a week has passed, that column is deleted and a new week is added to the end. So in my sample, the weeks start at 3/18/2019 in col C. When the date becomes 3/25 (col D), I would like the data under column C to be deleted and for everything to move to the left and a new week to be added on so that I still have columns C-V. I probably haven't explained this very well, but I'm sure you'll understand what I mean by looking at the worksheet. I presume I need a macro to do this, but if I could accomplish it another way that would be good too. The main thing is that I'd like this to happen automatically when I open the worksheet if possible.

    I have looked this up online, but haven't been able to understand the examples I looked at. Thanks for any assistance.
    Attached Files Attached Files

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Automatically delete columns after date has passed?

    Paste this in your 'ThisWorkbook' module and it will fire every time you open the file.
    If the date in C1 is older than a week it will delete that column and add a new one to the end.
    Please Login or Register  to view this content.
    Note it does not reproduce the colour banding you have to separate weeks (it's merely meant to point you in the right direction) and if you don't open the file for more than a week (i.e. there is more than one column to delete) it'll only delete the first column.

    It can be adapted to deal with all that with some effort.

    BSB

  3. #3
    Registered User
    Join Date
    02-16-2013
    Location
    Folsom, CA
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Automatically delete columns after date has passed?

    Thank you so much

+ 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. Protect all columns the date has passed with vba code
    By KIBAAKO in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-16-2018, 08:24 AM
  2. Locking Columns after todays date has passed
    By aidan5800 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-31-2018, 03:26 AM
  3. delete content from row when date has passed
    By bruno2580 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-12-2017, 08:54 AM
  4. [SOLVED] When date is passed certain row columns should change color
    By sealpino in forum Excel General
    Replies: 4
    Last Post: 03-18-2017, 01:47 PM
  5. Replies: 6
    Last Post: 04-24-2015, 03:16 AM
  6. Replies: 8
    Last Post: 06-20-2014, 02:40 AM
  7. [SOLVED] Help with code to delete a row if todays date has passed
    By nje in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-05-2013, 04:11 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