+ Reply to Thread
Results 1 to 5 of 5

VBA to delete number of sheets based on days in current month

  1. #1
    Forum Contributor
    Join Date
    07-21-2018
    Location
    London, England
    MS-Off Ver
    Excel for Mac Version 16.15
    Posts
    117

    VBA to delete number of sheets based on days in current month

    Hello!

    I have a template that has 31 sheets (named '1,' '2,' '3' etc.). When the template is opened, I need a macro that tests for the number of days in the current month and then deletes the sheets that don't exist in that month (i.e. if the template is opened in April, it will delete sheet '31' as there is no 31st day of April).

    Would someone please be able to help me with this?

    I have attached my workbook so you can see what I'm talking about

    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    05-12-2018
    Location
    Netherlands
    MS-Off Ver
    2016
    Posts
    266

    Re: VBA to delete number of sheets based on days in current month

    try this code, dont know if it works for the Mac though.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-21-2018
    Location
    London, England
    MS-Off Ver
    Excel for Mac Version 16.15
    Posts
    117

    Re: VBA to delete number of sheets based on days in current month

    Thank you for this! Do you have a way I can test it though? Because there are 31 days in March it won't delete anything haha!

    Thank you!

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,084

    Re: VBA to delete number of sheets based on days in current month

    Simply change the date on you computer to another month.

  5. #5
    Forum Contributor
    Join Date
    07-21-2018
    Location
    London, England
    MS-Off Ver
    Excel for Mac Version 16.15
    Posts
    117

    Re: VBA to delete number of sheets based on days in current month

    Of course! Thank you - it works perfectly!

+ 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. Replies: 16
    Last Post: 08-22-2017, 11:20 AM
  2. [SOLVED] No of Days Passed in current month based on =Today() Function
    By kskhan1105 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-06-2017, 10:16 AM
  3. [SOLVED] want to get the remaining days of the current month based on that respective month's one d
    By bala04msw in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-09-2017, 04:47 AM
  4. Replies: 1
    Last Post: 04-29-2016, 01:28 PM
  5. Running Average Based on Current number of days in month
    By dw_22801 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 06-22-2015, 12:48 PM
  6. [SOLVED] Determine work days in current month or next month based on day of the month
    By sbrnard in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-29-2014, 05:14 PM
  7. [SOLVED] how do i display the total number of days in the current month in.
    By timerigger in forum Excel General
    Replies: 6
    Last Post: 03-20-2005, 02:06 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