+ Reply to Thread
Results 1 to 3 of 3

put date in each worksheet and rename tab with date

  1. #1
    Registered User
    Join Date
    10-14-2013
    Location
    uk
    MS-Off Ver
    2016
    Posts
    87

    put date in each worksheet and rename tab with date

    Hi folks
    I have a workbook which contains a sheet for each day of the month.
    I would like a macro operable from the cover sheet which will do the following.

    Read the input date from cell c3 of the cover sheet (this will be manually changed every month)
    Put the incrementing date in cell D2 of each sheet
    Rename each tab to the incremental date

    Example attached
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: put date in each worksheet and rename tab with date

    Hi jimcuk,

    I tried to do what you asked. I added sheets to the test file so there are 33 sheets in the file. I hid any sheets which were illegal for a given month.

    I did not address the following issues:
    a. Worksheet Tab Color
    b. Date Sheets Cell 'C3' Date Value
    c. Will not work if Sheet 'Dates' is deleted or moved.


    The following code is included in the attached file in Module ModFormatRenameTabs. I assigned the Macro to your 'Rename Tabs' CommandButton.
    Please Login or Register  to view this content.

    It is a best practice to declare all variables. If you misspell a variable in your code, VBA will silently assume it is a Variant variable and go on executing with no clue to you that you have a bug. Go to the VBA development window, click Tools, Options, and check "Require Variable Declaration." This will insert the following line at the top of all new modules:
    Please Login or Register  to view this content.
    This option requires all variables to be declared and will give a compiler error for undeclared variables.

    I highly recommend that you use 'Option Explicit' in your code.

    The following item may help you now and in the future:
    Debugger Secrets:
    a. Press 'F8' to single step (goes into subroutines and functions).
    b. Press SHIFT 'F8' to single step OVER subroutines and functions.
    c. Press CTRL 'F8' to stop at the line where the cursor is.
    d. 'Left Click' the margin to the left of a line to set (or clear) a BREAKPOINT.
    e. Press CTRL 'G' to open the IMMEDIATE WINDOW. 'debug.print' statements send their
    output to the IMMEDIATE WINDOW.
    f. Select View > Locals to see all variables while debugging.
    g. To automatically set a BREAKPOINT at a certain location put in the line:
    'Debug.Assert False'
    h. To conditionally set a BREAKPOINT at a certain location put in lines similar to:
    if i >= 20 and xTV20 > 99.56 then
    Debug.Assert False
    endif
    i. A variable value will be displayed by putting the cursor over the variable name.

    To manually set a breakpoint, see http://www.wiseowl.co.uk/blog/s196/breakpoints.htm

    Lewis
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-14-2013
    Location
    uk
    MS-Off Ver
    2016
    Posts
    87

    Re: put date in each worksheet and rename tab with date

    Hi Lewis
    this is a duplicate thread due to a forum error yesterday and has been answered here
    http://www.excelforum.com/showthread...06#post4537606
    Thanks for your solution as well
    I will mark it solved

+ 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. [SOLVED] Add a new sheet and rename tab with a date
    By chrisrick in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-07-2014, 12:36 PM
  2. [SOLVED] Rename tab with date from a cell for each worksheet in the workbook
    By tmeakin! in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2013, 05:23 PM
  3. [SOLVED] How to copy worksheet to new worksheet each week and rename the tabs for the monday date.
    By tmeakin! in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-04-2013, 01:17 PM
  4. Copy a worksheet and rename with todays date
    By batchy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2011, 06:29 AM
  5. Macro for button to create new worksheet and rename with todays date
    By BBXguy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2009, 03:47 PM
  6. Macro to rename a worksheet to "Numbers as of [+today's date]"
    By duugg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2009, 03:28 PM
  7. [SOLVED] Date updates from worksheet to chart & changes date to a date series! Help!!
    By Jayjg in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-22-2005, 11:06 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