+ Reply to Thread
Results 1 to 4 of 4

Programming code : Sheets.Add After:=Sheets(Sheets.Count)

  1. #1
    Registered User
    Join Date
    09-06-2015
    Location
    Pratclaux, France
    MS-Off Ver
    2010
    Posts
    3

    Programming code : Sheets.Add After:=Sheets(Sheets.Count)

    After the sheet has been made :
    it will be designed to my needs.
    No problems with making the sheet.

    In the VBA editor I have given the sheet a Private sub
    Please Login or Register  to view this content.
    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer

    Now I want to progam in VBA this Private Sub routine to the new added sheet.
    Whoknows the solution?

    Moreover the Application.DisplayAlerts does not work properly, when ending this procedure ther comes a system warning about the protected sheet.

    Somebody to help me?
    Last edited by 6StringJazzer; 09-09-2015 at 01:41 PM.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Programming code : Sheets.Add After:=Sheets(Sheets.Count)

    Welcome to the forum! Please use code tags and paste code between them. Click the # to insert the tags.

    Rather than Unprotect, use Protect and set the option UserInterfaceOnly:=True. I normally set all my sheet passwords in the ThisWorkbook object's Open event so that code can modify ranges.

    While you can use VBComponents object to add code like that, it is better to make a copy of the sheet instead.

  3. #3
    Registered User
    Join Date
    09-06-2015
    Location
    Pratclaux, France
    MS-Off Ver
    2010
    Posts
    3

    Re: Programming code : Sheets.Add After:=Sheets(Sheets.Count)

    At this moment I use indeed a Template (Copy) of the sheet but I was interested when I was building up this sheet that there was a code to program the property of that sheet to add a private sub.
    Thanks for the suggestions of Unprotect. I'll try it !

  4. #4
    Registered User
    Join Date
    09-06-2015
    Location
    Pratclaux, France
    MS-Off Ver
    2010
    Posts
    3

    Re: Programming code : Sheets.Add After:=Sheets(Sheets.Count)

    OK I try to find out how to place the code tags, thanks anyhow. Problem solved by copying a Template sheet

+ 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. [SOLVED] Vba code to copy/move 12 sheets to master sheets
    By tieyanna in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-25-2014, 08:32 PM
  2. Code to delete sheets and rename sheets in a protected workbook?
    By leaning in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-07-2011, 03:02 AM
  3. [SOLVED] Create New WB with copy of Sheets 1 & 2 when sheets count reaches 100
    By Corey in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-25-2006, 11:55 PM
  4. Replies: 6
    Last Post: 03-29-2006, 07:50 AM
  5. [SOLVED] How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook?
    By Dmitry in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-29-2006, 07:50 AM
  6. Replies: 6
    Last Post: 03-29-2006, 07:50 AM

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