+ Reply to Thread
Results 1 to 5 of 5

Naming a new worksheet

  1. #1
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Atlanta
    MS-Off Ver
    Excel 2007
    Posts
    171

    Naming a new worksheet

    Hello,

    If I wanted to add a new worksheet to a workbook and rename it, can I do something like this:
    Please Login or Register  to view this content.
    or does this require two steps, 1) create 2) then name?

    If it's possible to achieve this task in one step, can someone correct the line of code I'm using? (note: Dim NewWS As Worksheet)

    Thanks!

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Naming a new worksheet

    Try

    Please Login or Register  to view this content.
    HTH
    Regards, Jeff

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Naming a new worksheet

    Is this cheating? Still on one line

    Please Login or Register  to view this content.
    You can do it one line without the variable. Variable requires 2 steps as far as i know.

  4. #4
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Atlanta
    MS-Off Ver
    Excel 2007
    Posts
    171

    Re: Naming a new worksheet

    @jeffreybrown - perfect, and you pointed out some unnecessary code I was using
    @stnkynts - yours did work too, but it seems I didn't need to set NewWS to the worksheet - this line was running through a loop

    Thank you both!

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Naming a new worksheet

    You're welcome…glad you have a workable solution and thanks for the feedback...

+ 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