+ Reply to Thread
Results 1 to 8 of 8

Need Macro to Create New Worksheet Named After Currently Selected Cell

  1. #1
    Registered User
    Join Date
    01-03-2013
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Question Need Macro to Create New Worksheet Named After Currently Selected Cell

    Hello all,

    I am new to the forum and entirely new to VBA. I have been working on a project and have managed to write a couple macros thus far, one that returns the current sheet name to a cell, and two that protect or unprotect all sheets in the workbook.

    I am stuck on this macro now, and have been looking everywhere with no avail. What I need is just a simple macro to take the currently selected cell and create a new worksheet with that name (it is a string). I also need to paste a template into that new worksheet from a pre-existing sheet.

    Any help would be greatly appreciated, this is my first post. I am using Excel 2010 by the way.

    -Brett

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

    Re: Need Macro to Create New Worksheet Named After Currently Selected Cell

    This should help you with part1. A lot more information is needed to assist you with your second question.

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Need Macro to Create New Worksheet Named After Currently Selected Cell

    Hi,

    Maybe something like

    Please Login or Register  to view this content.
    and to
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Need Macro to Create New Worksheet Named After Currently Selected Cell

    See if this will get you started. The sub calls function GoodSheetName to validate a good sheet name

    Please Login or Register  to view this content.
    Last edited by mike7952; 01-03-2013 at 01:17 PM.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  5. #5
    Registered User
    Join Date
    01-03-2013
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Need Macro to Create New Worksheet Named After Currently Selected Cell

    @stnky

    That macro worked great.

    As for the second part, I have a template sheet that I want copied into the new sheet after it is made. It could be either the entire contents of the sheet, or just the values and format of columns A through N. Does that help?

    -Brett

  6. #6
    Registered User
    Join Date
    01-03-2013
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Need Macro to Create New Worksheet Named After Currently Selected Cell

    @mike

    Your macro gets me the copy of Template, called Template (2), and a Run-time error '424': Object Required. When I run debug, I get .Name = shName highlighted.

  7. #7
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Need Macro to Create New Worksheet Named After Currently Selected Cell

    Try this then

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    01-03-2013
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Need Macro to Create New Worksheet Named After Currently Selected Cell

    @mike

    Nailed it, Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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