+ Reply to Thread
Results 1 to 2 of 2

VBA code to Copy and Rename Worksheet

  1. #1
    Registered User
    Join Date
    05-12-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    42

    VBA code to Copy and Rename Worksheet

    Hey folks,

    I am fairly new to VBA coding in Excel and I am trying compile a script that will allow me to copy an existing worksheet and rename it based off of values referenced in the range A2:A54 in another worksheet.

    Here is an overview:

    1. Worksheet to copy - "Template"
    2. Worksheet with range for renaming - "Weekly Overview"
    3. Cell range for renaming - "A2:A54"
    4. Values in the cells are as follows - A:2 = 1/4/10, A:3 = A2+7, A:4 = A3+7, etc.
    5. The issue I am having is the fact that the values in the cells are formatted as date and have a 7 day increment (basically, each cell lists the first day of each week)
    6. I would like to keep the formatting "MM-DD-YYYY" in the tab name

    This is what I have so far:
    --------------------
    Please Login or Register  to view this content.
    --------------------

    This currently fails because of the "/" in the date format even though I have a custom format of "MM-DD-YYYY" on the cell range.

    Any help with this one would be greatly appreciated.
    Last edited by davesexcel; 05-12-2010 at 07:14 PM. Reason: Code tags required for VBA Code, Please read the Forum Rules

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: VBA code to Copy and Rename Worksheet

    If you have a date in A1 here is what you could use to name the sheet with that date

    Please Login or Register  to view this content.
    Make it work for your code

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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