+ Reply to Thread
Results 1 to 5 of 5

Renaming a Worksheet by Macro

  1. #1
    Registered User
    Join Date
    02-18-2013
    Location
    Great Southern Land
    MS-Off Ver
    Excel 2007
    Posts
    11

    Renaming a Worksheet by Macro

    Hi guys, I'm attempting to write a Macro to add and rename a Worksheet -

    Please Login or Register  to view this content.
    The problem I'm having is that if the macro is run a second time, the Sheets.Count brings "Sheet2" which stops the process. Is there a way to alter the macro to read the actual next sheet?

    Thanks again,
    Den

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,254

    Re: Renaming a Worksheet by Macro

    Hi Denno,

    Try this
    Please Login or Register  to view this content.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    06-14-2013
    Location
    Australia
    MS-Off Ver
    2007/2013/2016
    Posts
    14

    Re: Renaming a Worksheet by Macro

    I noticed that if you try to run this twice and already have a sheet named "ToDBase" you will encounter an error.
    Last edited by bradja; 06-15-2013 at 12:55 AM. Reason: Refine statement

  4. #4
    Registered User
    Join Date
    02-18-2013
    Location
    Great Southern Land
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Renaming a Worksheet by Macro

    Excellent work. Thanks MarvinP..............

  5. #5
    Registered User
    Join Date
    02-18-2013
    Location
    Great Southern Land
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Renaming a Worksheet by Macro

    Yeah, I am aware of that, bradja. But it was more about trialling and developing the Macro as I go without forever remembering to delete the sheet on every run..

+ 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