+ Reply to Thread
Results 1 to 2 of 2

Naming worksheets

  1. #1
    Registered User
    Join Date
    01-17-2006
    Posts
    21

    Naming worksheets

    Hi,

    I have a macro that makes a copy of sheet2 at the end of the workbook.
    Is it possible to change the name of the new workseet to the contents of a cell in sheet1?

    Thanks, Simon

  2. #2
    Jim Thomlinson
    Guest

    RE: Naming worksheets

    Sure. You should check to make sure that the name in the Cell will not be a
    duplicate of another sheet name.

    sheet2.copy After:=Sheet2
    'The copied sheet is now the active sheet
    With activesheet
    if sheetexists(.range("A1").Text) = false then .name = .range("A1").Text
    end with



    Public Function SheetExists(SName As String, _
    Optional ByVal Wb As Workbook) As Boolean
    'Chip Pearson
    On Error Resume Next
    If Wb Is Nothing Then Set Wb = ThisWorkbook
    SheetExists = CBool(Len(Wb.Sheets(SName).Name))
    End Function
    --
    HTH...

    Jim Thomlinson


    "simonhall" wrote:

    >
    > Hi,
    >
    > I have a macro that makes a copy of sheet2 at the end of the workbook.
    >
    > Is it possible to change the name of the new workseet to the contents
    > of a cell in sheet1?
    >
    > Thanks, Simon
    >
    >
    > --
    > simonhall
    > ------------------------------------------------------------------------
    > simonhall's Profile: http://www.excelforum.com/member.php...o&userid=30582
    > View this thread: http://www.excelforum.com/showthread...hreadid=502292
    >
    >


+ 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