1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Rename a Excel worksheet with the text in a cell

Discussion in 'Business Applications' started by smarts56, Sep 14, 2004.

Thread Status:
Not open for further replies.
  1. smarts56

    smarts56 Thread Starter

    Joined:
    Sep 14, 2004
    Messages:
    2
    Could someone tell me how to write a macro to rename a Excel worksheet using the text in a cell in the same worksheet.
     
  2. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    Just be aware that the sheet name cannot contain some certain characters such as / : * and a few others. Also be aware that the sheet name cannot exceed 31 characters (including spaces)

    Here are some various code example of how to achieve what you want


    ActiveSheet.Name = Range("A1").Text

    Sheets("Sheet1").Name = Range("A1").Text

    Sheets(1).Name = Range("A1").Text

    Sheets("Sheet1").Name = Activecell.Text <----- If the source cell is selected



    Rollin
     
  3. smarts56

    smarts56 Thread Starter

    Joined:
    Sep 14, 2004
    Messages:
    2
    Thanks that worked great!
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/274079

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice