+ Reply to Thread
Results 1 to 3 of 3

accessing worksheet with name that varies with last business day of the month

  1. #1
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    accessing worksheet with name that varies with last business day of the month

    Hi,

    I access a workbook that has number of worksheets and one worksheet name contains only month-end date (for instance "31-10-2020")? However, when month-end is a public holiday and/or weekends, the name of worksheet would be the last business day. I am not the owner of that workbook and I open ReadOnly while accessing. The first 2 characters in all other worksheets do not have numeric values.

    The access to this workbook is automated and I cannot hardcode the date because of variation of month-end name. My macro stores day, month, and year in separate variables. I am seeking your guidance to solve if for instance, the name of the worksheet is "28-10-2020", how can I change the value to 28 in day variable using loop and if condition?

    I activate the worksheet that I access using this statement:

    Please Login or Register  to view this content.
    Thank you for your guidance in advance.

    With regards,
    Roshan Shakya

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,307

    Re: accessing worksheet with name that varies with last business day of the month

    Possibly you could adapt this...
    Please Login or Register  to view this content.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: accessing worksheet with name that varies with last business day of the month

    Quote Originally Posted by Roshan.Shakya View Post
    I access a workbook that has number of worksheets and one worksheet name contains only month-end date (for instance "31-10-2020")? However, when month-end is a public holiday and/or weekends, the name of worksheet would be the last business day.
    Assuming you have list of holidays in sheet named "Holidays" from A2:Ax in Date format.
    Please Login or Register  to view this content.

+ 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. Look in previous month folder if -2 business day is previosu month
    By jamesmullens in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-18-2018, 12:10 AM
  2. Replies: 2
    Last Post: 05-20-2013, 11:14 AM
  3. [SOLVED] Need the Second Business Day of the Month
    By Jrbeene in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-12-2012, 01:55 PM
  4. How to add worksheet before another known worksheet that varies in location in file
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-05-2012, 08:57 AM
  5. Last business day of month function +1,2,3,4 business days
    By dstock in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-21-2008, 06:08 PM
  6. Last business day of month?
    By Casrlos A. in forum Excel General
    Replies: 1
    Last Post: 08-14-2006, 10:00 AM
  7. [SOLVED] First Business day of the month?
    By Ron Rosenfeld in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2005, 06:20 PM

Tags for this Thread

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