+ Reply to Thread
Results 1 to 7 of 7

How to disable “Insert worksheet “ form tab ? except “input”,”output”, and “temp”.

Hybrid View

nur2544 How to disable “Insert... 01-29-2015, 10:01 AM
sweep Re: How to disable “Insert... 01-29-2015, 10:17 AM
Faridwahidi Re: How to disable “Insert... 01-29-2015, 10:46 AM
nur2544 Re: How to disable “Insert... 01-29-2015, 11:08 AM
nur2544 Re: How to disable “Insert... 01-29-2015, 11:00 AM
Alf Re: How to disable “Insert... 01-29-2015, 11:14 AM
pdalal Re: How to disable “Insert... 01-29-2015, 11:17 AM
  1. #1
    Forum Contributor
    Join Date
    06-08-2012
    Location
    BD
    MS-Off Ver
    Microsoft Office 2016
    Posts
    640

    How to disable “Insert worksheet “ form tab ? except “input”,”output”, and “temp”.

    Dear all , i have three worksheets “input”,”output”, and “temp”. here sheet “temp” is not visible . it is being created for processing some activity and after that it deleted during run macro. I want to implement below macro code sothat no one add new sheet except “temp “sheet. below code is working fine if “temp” sheet is not created by macro . how to implement some logic sothat it can ignore the “temp” sheet .

    'code by RoyUK
    Private Sub Workbook_NewSheet(ByVal Sh As Object)
        Application.DisplayAlerts = False
        ActiveSheet.Delete
        MsgBox "No new sheets allowed in this workbook", vbCritical, "User warning"
        Application.DisplayAlerts = True
    End Sub
    Last edited by nur2544; 01-29-2015 at 10:03 AM.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: How to disable “Insert worksheet “ form tab ? except “input”,”output”, and “temp”.

    Hi,

    Could you disable events in your code and then re-enable them when complete?

    Sub YourSub()
    Application.EnableEvents = False
    
    'code from your temp sheet macro
    
    Application.EnableEvents = True
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    702

    Re: How to disable “Insert worksheet “ form tab ? except “input”,”output”, and “temp”.

    Hi Nur,

    your problem is ActiveSheet.Delete should be sh.Delete

    In workbook change event sh as object is refer to Activesheet

    the same thing goes to ActiveCell.Row is refer to Target.Row. Just FYI.


    you may try this,
    Private Sub Workbook_NewSheet(ByVal Sh As Object)
    
    
            Application.DisplayAlerts = False
            Sh.Delete
            Application.DisplayAlerts = True
    
        MsgBox "No new sheets allowed in this workbook", vbCritical, "User warning"
    End Sub
    Last edited by Faridwahidi; 01-29-2015 at 10:58 AM.

  4. #4
    Forum Contributor
    Join Date
    06-08-2012
    Location
    BD
    MS-Off Ver
    Microsoft Office 2016
    Posts
    640

    Re: How to disable “Insert worksheet “ form tab ? except “input”,”output”, and “temp”.

    Hi Faridwahidi , it doesn't work for my case. it doesn't allow creating "temp" sheet which is required . earlier i told that no new sheet allowed except “input”,”output”, and “temp”. where temp sheet creating & deleting inside the module itself . but i am telling about no manual intervention to create new sheet . hope got it .

  5. #5
    Forum Contributor
    Join Date
    06-08-2012
    Location
    BD
    MS-Off Ver
    Microsoft Office 2016
    Posts
    640

    Re: How to disable “Insert worksheet “ form tab ? except “input”,”output”, and “temp”.

    Hi sweep , it works perfectly , thanks you very much..

  6. #6
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,794

    Re: How to disable “Insert worksheet “ form tab ? except “input”,”output”, and “temp”.

    Perhaps this link could be of interest as well?

    http://blogmines.com/blog/how-to-pre...in-excel-2010/

    Alf

  7. #7
    Forum Contributor
    Join Date
    08-22-2013
    Location
    columbus,oh
    MS-Off Ver
    Office 365
    Posts
    190

    Re: How to disable “Insert worksheet “ form tab ? except “input”,”output”, and “temp”.

    wrong post I apologise.

+ 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. Randomly sample 30 columns from worksheet input and print them in worksheet Output
    By Savan87 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-05-2012, 01:00 PM
  2. Input Sheet, Output Form - Can I do it?
    By GalFriday in forum Excel General
    Replies: 5
    Last Post: 08-27-2012, 09:01 PM
  3. Form to output input data into spreadsheet
    By kronos in forum Excel General
    Replies: 1
    Last Post: 06-23-2010, 01:03 PM
  4. Replies: 1
    Last Post: 06-23-2010, 07:08 AM
  5. format cell from data input to output form
    By Brad Stevenson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-19-2005, 01:06 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