+ Reply to Thread
Results 1 to 12 of 12

Prevent user from running private macros

Hybrid View

  1. #1
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Prevent user from running private macros

    Quote Originally Posted by trimmjens View Post
    Hi,

    I need macros to be run on the right sheet only, else it can delete other codes on the sheet.
    If the macros that you write must be run on a particular sheet, then specify that sheet in the code so it will only run on the good sheet. Never use ActiveSheet (unless you want the user to be able to control which sheet is effected by the macro). If some macros can be run on most sheets, but not all, code to test if the bad sheets will be effected and end the sub if they are.

    1) Use code names rather than tab names.
    2) Specify the heck out of your code.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  2. #2
    Registered User
    Join Date
    02-01-2014
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Prevent user from running private macros

    Quote Originally Posted by mikerickson View Post
    If the macros that you write must be run on a particular sheet, then specify that sheet in the code so it will only run on the good sheet. Never use ActiveSheet (unless you want the user to be able to control which sheet is effected by the macro). If some macros can be run on most sheets, but not all, code to test if the bad sheets will be effected and end the sub if they are.

    1) Use code names rather than tab names.
    2) Specify the heck out of your code.
    I have done that on one of the codes.

    If ActiveSheet.Name = "Msg" Then Exit Sub
    It is a solution for it, but I hoped it was one easy way to do it for all subs instead of specifying it for each one.

    Thanks anyway!

+ 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. Prevent macros running after message box show
    By herukuncahyono in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-15-2013, 01:09 AM
  2. Prevent two macros from running at the same time
    By Kreef in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2011, 10:36 PM
  3. Prevent private sub macro from running
    By jman0707 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-15-2008, 01:35 AM
  4. Prevent a user from running a macro
    By vbace2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-27-2006, 11:28 PM
  5. Prevent others from running my macros
    By Frederick Chow in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-13-2005, 02:10 PM

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