+ Reply to Thread
Results 1 to 5 of 5

Macro to rename worksheets

  1. #1
    Registered User
    Join Date
    01-07-2004
    Location
    Manchester UK
    MS-Off Ver
    Office 2010
    Posts
    73

    Macro to rename worksheets

    Hello,

    Is there any way to have a macro create and rename worksheets so that there is one worksheet for each weekday (monday to friday).

    So for example, in december, it would create 21 worksheets for each weekday, each with the worksheet name showing the weekday it relates to.
    1 Dec 2006, 4 Dec 2006, and so on.

    Is this possible?

    Taking it a step further, could it be tweaked so that Bank Holidays are excluded, such as christmas day and boxing day?
    Last edited by tanktata; 12-17-2006 at 02:45 PM.

  2. #2
    Forum Contributor
    Join Date
    11-29-2003
    Posts
    1,203
    Try this ...

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-07-2004
    Location
    Manchester UK
    MS-Off Ver
    Office 2010
    Posts
    73
    Tried that.

    I get a runtime error '1004'

    Says;

    Method 'Add' of object 'Sheets' Failed


    It fails at this line;


    Set ws = ThisWorkbook.Worksheets.Add(after:= _
    ThisWorkbook.Worksheets.Count)



    Does the first sheet have to be named something in particular to make it work?

  4. #4
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by tanktata
    Tried that.

    I get a runtime error '1004'

    Says;

    Method 'Add' of object 'Sheets' Failed

    It fails at this line;

    Set ws = ThisWorkbook.Worksheets.Add(after:= _
    ThisWorkbook.Worksheets.Count)


    Does the first sheet have to be named something in particular to make it work?
    Hi,,

    in place of
    Please Login or Register  to view this content.
    try
    Please Login or Register  to view this content.
    and the sheets add as required.

    hth
    ---
    Si fractum non sit, noli id reficere.

  5. #5
    Registered User
    Join Date
    01-07-2004
    Location
    Manchester UK
    MS-Off Ver
    Office 2010
    Posts
    73
    That works, thanks a lot

+ 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