Results 1 to 6 of 6

Excel VBA: How to reference sheet names that are based on dates

Threaded View

  1. #1
    Registered User
    Join Date
    08-20-2019
    Location
    Derby, England
    MS-Off Ver
    2016
    Posts
    7

    Lightbulb Excel VBA: How to reference sheet names that are based on dates

    Hi,

    I currently have a workbook that can generate a new sheet via a macro button that is titled with the current date that the macro button was clicked. E.g "08-15-2019". I have it so that it will take you to the sheet named by the current date if it already exists and if it doesn't, it'll create one (named by the current date). I also have a user form that can be used to print information to the cells of the various sheets.

    I want to be able to reference the sheets to print information on based on the current date that my excel user form is used on. However I do not wish to right 1000s of lines of code just to explicitly reference every possible date for the foreseeable future: e.g Range("08-15-2019!B4").Cells(1, 1) etc.

    I tried to use: Range("Date$!B4").... but given that its within "" I knew it wouldn't work. Furthermore I tried Range(Date$!B4).... but that also doesn't work. How could I get my code to search through the workbook for the various sheets until it finds the one named with current date without explicitly referencing it? Or better yet how can I reference the sheet simply by having the program search for the one named by the current date?

    Many Thanks!
    Last edited by MiguelSPerera; 08-20-2019 at 08:21 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 07-24-2019, 01:41 AM
  2. Finding average between dates that reference a cell for names
    By miribilist in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-15-2019, 07:58 AM
  3. [SOLVED] Reference all sheets with dates for names by Month
    By jtmoore in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-03-2019, 01:24 PM
  4. [SOLVED] Copying only specific file names from a directory based on Excel Sheet
    By pynergee in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-20-2016, 12:21 PM
  5. Code to reference sheet names based on index
    By qstillso in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-23-2015, 02:02 PM
  6. From A Table Of Names And Birth Dates Pull A List Of Names As Of A Reference Date And Ther
    By rahuleyes in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 17
    Last Post: 11-27-2014, 03:44 PM
  7. Changing Sheet Names based on a Cell Reference
    By tjloggia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-04-2012, 04:35 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