+ Reply to Thread
Results 1 to 3 of 3

Password Protection in Macro

Hybrid View

  1. #1
    Registered User
    Join Date
    05-07-2013
    Location
    Anchorage
    MS-Off Ver
    Excel 2007
    Posts
    45

    Password Protection in Macro

    I am trying to develop a spreadsheet with some data in it. Once a user enters the data, clicks on Submit Data. The Submit Data activates a macro which password protects the worksheet. I already have a macro doing this but without password. Is there any way I can add password protection in macro?

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Password Protection in Macro

    Hi,

    Yes, you simply add
    password:="your password"
    as an argument to the line that protects the sheet- for example
    activesheet.protect password:="your password"
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Password Protection in Macro

    you can use Protect method of worksheet object, e.g.
    ActiveSheet.Protect "yourpassword"
    of course you can specify certain allowed and forbidden actions, e.g.
    ActiveSheet.Protect "yourpassword", DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowInsertingColumns:=True, AllowInsertingRows:=True
    If you are pleased with a member's answer then use the Star icon to rate it.

+ 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. Password protected macro workbook - remove protection
    By olwy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2014, 10:48 AM
  2. [SOLVED] Password Protection blocks macro
    By rjrcornelissen in forum Excel General
    Replies: 6
    Last Post: 07-31-2012, 09:43 AM
  3. password protection macro not protecting all sheets the same
    By AKL01 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-21-2011, 05:05 PM
  4. Create Password Protection with a macro
    By King_Crud in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-08-2011, 10:16 AM
  5. Password protection for a macro button
    By ramakavin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-08-2008, 05:22 PM
  6. password protection-is there anyway to put a password on running a macro in excel?
    By Solarissf in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2008, 10:06 AM
  7. [SOLVED] need help with password protection and macro
    By Brian in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2005, 04: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