+ Reply to Thread
Results 1 to 10 of 10

Rename worksheet based on content in Cell C3

  1. #1
    Registered User
    Join Date
    06-08-2008
    Posts
    36

    Rename worksheet based on content in Cell C3

    Hi All,

    My code is as below

    Please Login or Register  to view this content.
    Is there anyway i can rename the the current worksheet with the content in Cell C3?

    Regards,

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Rename worksheet based on content in Cell C3

    You don't need to activate workbooks like that.

    How are you sure that you will paste to the correct cell, you assume in the code that the destination cell is selected, could be a problem if it isn't.

    To name a sheet
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    06-08-2008
    Posts
    36

    Re: Rename worksheet based on content in Cell C3

    i got this code from the Marco I recorded.

    I am puzzled by this sentence of coding
    Please Login or Register  to view this content.
    When I remove the 'Offset(-24,-2), the whole marco will not work.

    For my end product, I want to copy the selected cells,from A1 to C28, in 'main.xls', to a newly created sheet in 'Project Database.xls'.

    I managed to rename the sheet.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Rename worksheet based on content in Cell C3

    Are you sure that you recorded this line
    Please Login or Register  to view this content.
    I don't think he code is recorded, it makes little sense with the range references. I'm guessing at what you are doing
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-08-2008
    Posts
    36

    Re: Rename worksheet based on content in Cell C3

    Yes. These are from my recorded marco.. ;-)

    the code you provided failed at
    Please Login or Register  to view this content.
    My inital thinking was that the 'copied' items have not been 'pasted' yet, so it's a empty cell. I tried to shift the
    Please Login or Register  to view this content.
    above the code, but it still fails.

    is it that I need to set the new sheet as active, then i do a 'paste' then i rename my sheet based on C3 ?

    I can see that it added a new sheet in the project database.xls

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Rename worksheet based on content in Cell C3

    Try this
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-08-2008
    Posts
    36

    Re: Rename worksheet based on content in Cell C3

    fail at
    Please Login or Register  to view this content.
    Error Code: object does not support this property or method

    I skip this step, it fails at the naming part. This i assume is because the cell is empty..

    i look through excel help file and found this code
    Please Login or Register  to view this content.
    But how do i point 'sheet1' as the newly created sheet?

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Rename worksheet based on content in Cell C3

    It should automatically be the active sheet. There is a typo in the code
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-08-2008
    Posts
    36

    Re: Rename worksheet based on content in Cell C3

    Hi Roy,

    I change it to
    Please Login or Register  to view this content.
    Somehow 'Paste' doesn't work on my side..

    Anyway, thanks

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Rename worksheet based on content in Cell C3

    Is it working then? If so please mark your question solved

+ 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