Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 3 of 3

Thread: Rename Sheet Based On Cell

  1. #1
    Join Date
    12th January 2008
    Posts
    6

    Rename Sheet Based On Cell

    Hi

    i am trying to create a macro that renames a newly created sheet with whatever i paste into A1

    VB:
     
    Sub Example() 
         '
         ' Example Macro
         ' Macro recorded 14/01/2008 by KCHAN
         '
         
         '
        Sheets("Sheet1").Select 
        Sheets("Sheet1").Copy After:=Sheets(4) 
        Sheets("Data Conversion").Select 
        Range("A2").Select 
        Selection.Copy 
        Sheets("Sheet1 (2)").Select 
        Range("A1").Select 
        ActiveSheet.Paste 
        Sheets("Sheet1 (2)").Select 
        Sheets("Sheet1 (2)").Name = "Grapefruit" 
        Range("J29").Select 
    End Sub 
    
    
    Grapefruit is what is pasted into cell A1 but as you can see the sheet is renamed grapefruit regardless of what is actually copied.

    Any help is much appreciated

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    18th February 2004
    Location
    Florida
    Posts
    181

    Re: Sheet Renaming Macros

    Hello,

    Maybe changing this line:
    VB:
    Sheets("Sheet1 (2)").Name = "Grapefruit" 
    
    
    to
    VB:
    Sheets("Sheet1 (2)").Name = Range("A1").Text 
    
    
    HTH

    JL

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    8th December 2006
    Location
    New Zealand
    Posts
    3,924

    Re: Sheet Renaming Macros

    VB:
    Sub Example() 
         
        Sheets("Sheet1").Copy After:=Sheets(4) 
        With Sheets(5) 
            Sheets("Data Conversion").Range("A2").Copy .Range("A1") 
            .Name = .Range("A1").Value 
        End With 
    End Sub 
    
    

Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Rename/Name Sheet Tabs Based on a Cell
    By ilpap75 in forum EXCEL HELP
    Replies: 5
    Last Post: February 24th, 2012, 06:30
  2. Click button to rename sheet tabs based on range
    By sweather in forum EXCEL HELP
    Replies: 24
    Last Post: August 16th, 2006, 08:35
  3. Rename Cell Based on Cell Content
    By 043792 in forum EXCEL HELP
    Replies: 4
    Last Post: January 10th, 2006, 01:58
  4. Rename sheet based on table
    By andrea16 in forum EXCEL HELP
    Replies: 2
    Last Post: July 7th, 2005, 23:50
  5. rename sheet ( 97 & 2000)
    By sreerajks in forum EXCEL HELP
    Replies: 1
    Last Post: January 23rd, 2004, 17:51

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
  •  
porno