+ Reply to Thread
Results 1 to 5 of 5

Macro to make new sheet when clicked once and next time it should go to the newly created

  1. #1
    Registered User
    Join Date
    09-18-2014
    Location
    United Arab Emirates
    MS-Off Ver
    2010
    Posts
    3

    Smile Macro to make new sheet when clicked once and next time it should go to the newly created

    Hi Guyz,

    I am a newbie to VBA coding. Therefore I am not sure if this is possible or not.

    Basically I want to make a button which when clicked once will go make a copy of a sheet named "template", but when it copies it will tell the user to enter the name of sheet. And once the user makes that new sheet and fills in the fields in the new sheet, the next time he clicks the same button it will take him to the page he has created before when he clicked the button the first time. Hope this makes sense

    For example , User clicks the button "noob", excel makes a copy of a sheet named template in the workbook and asks the user to enter the name of the sheet, the user enters the name of the sheet as template 22 and fills in this sheet. Next time the user clicks the button "noob" it will take him to the sheet template22.

    I am using this code to make new sheet as of now

    Plzzzzzz help!

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Macro to make new sheet when clicked once and next time it should go to the newly crea

    So the button will only work once, he'll click it, create & name the sheet, then from that point on it just goes to the sheet?
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    09-18-2014
    Location
    United Arab Emirates
    MS-Off Ver
    2010
    Posts
    3

    Re: Macro to make new sheet when clicked once and next time it should go to the newly crea

    Yes..basically he'll click it, create and name the sheet and then the next time he clicks the same button it will take him to the sheet he just created . Hope its clear. And thanks a lot for your quick reply.

  4. #4
    Registered User
    Join Date
    09-18-2014
    Location
    United Arab Emirates
    MS-Off Ver
    2010
    Posts
    3

    Re: Macro to make new sheet when clicked once and next time it should go to the newly crea

    Sorry just thought of one more thing, he clicks the button and makes the sheet, but he deletes it and then he clicks the button again which allows him to make another sheet....is it possible to code it this way......Basically its like an if statement , if (the sheet is there) then (go to the sheet) else (make new sheet)....Sorry for the trouble chief.

    This below code I use can be used to make new sheets, but it wont let me go to the sheet once it is created and I am not sure how to code that.

    Sub MakeNewHeirarchy()

    Dim ShtName$

    Sheets("Heirarchy").Copy After:=Sheets(Sheets.Count)

    ShtName = InputBox("Enter Tool Serial No.")

    Sheets(Sheets.Count).Name = ShtName

    Sheets(ShtName).Visible = True

    End Sub

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro to make new sheet when clicked once and next time it should go to the newly crea

    Hi, farhan.mk,

    please have a look at Forum Rule #3 and wrap your procedure with code-tags as requested there.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Add vba to current macro to copy table into newly created sheet
    By Morgraal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-15-2013, 07:10 AM
  2. [SOLVED] Pulling data from a main sheet and placing it onto a newly created sheet
    By cbomination in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 05-25-2012, 10:12 AM
  3. Getting Macro to reference newly created sheet
    By creuther in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-27-2011, 01:04 AM
  4. Replies: 0
    Last Post: 05-29-2009, 09:42 AM
  5. macro that will automatically link a newly created worksheet to a summary sheet
    By liquidblack in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2009, 03:22 PM

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