+ Reply to Thread
Results 1 to 15 of 15

Name a Worksheet Based on a Value in a Cell

Hybrid View

  1. #1
    Registered User
    Join Date
    06-14-2010
    Location
    United States
    MS-Off Ver
    Microsoft Excel 2007
    Posts
    18

    Re: Name a Worksheet Based on a Value in a Cell

    When I put the below code in , I get a Microsoft Visual Basic box pop up that says

    Run-time error '1004':
    Application-defined or object-defined error, then I have the option to end, debug, or help.

    Sub bridgeport()
    Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Worksheets
    ws.Activate
    ActiveSheet.Name = Range("S6").Value
    Next ws
    End Sub

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Name a Worksheet Based on a Value in a Cell

    Try:

    Sub bridgeport()
    Dim ws As Worksheet
    On Error Resume Next
    For Each ws In ActiveWorkbook.Worksheets
        ws.Activate
        ActiveSheet.Name = ws.Range("S6").Value
    Next ws
    On Error GoTo 0
    End Sub

+ 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. Macro to hide rows on a worksheet, based on a cell's value on another worksheet.
    By buttercup116 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-29-2014, 10:47 AM
  2. Copy data from a copied worksheet to another worksheet based on cell reference
    By tantcu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-08-2013, 02:18 PM
  3. Macro to select worksheet based on cell value and then return data to diff worksheet
    By clnossok in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-22-2013, 07:48 PM
  4. Replies: 4
    Last Post: 10-30-2012, 06:15 PM
  5. [SOLVED] Copy rows from my main worksheet to another worksheet based on data in one cell
    By gcol in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 08-08-2012, 05:12 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