+ Reply to Thread
Results 1 to 4 of 4

Unprotecting a sheet to run a macro

  1. #1
    Forum Contributor
    Join Date
    08-19-2009
    Location
    uk
    MS-Off Ver
    Excel 2010
    Posts
    147

    Unprotecting a sheet to run a macro

    HI all,

    Someone at work created a macro that sorts sheet 2 by column D. Then copies the first 3 columns into sheet T (B to D) and then sorts that sheet by column1.

    They have this bit working ok but would like to protect sheet t to stop people changing things. I tried adding in some code to unprotect the sheet --> then do the macro ----> then reprotect the sheet but its giving errors. Any ideas. Attached is the worksheet

    Many thanks,

    Chemist

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Unprotecting a sheet to run a macro

    Your code & errors would help

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Unprotecting a sheet to run a macro

    If you protect the sheet with a macro, you have an option to only apply the protection to the user interface. That way you can manipulate the workbook using VBA without having to unprotect sheets.

    Here's an example of a procedure I wrote recently that does that
    (along with changing a few protection variables):
    Please Login or Register  to view this content.
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Forum Contributor
    Join Date
    08-19-2009
    Location
    uk
    MS-Off Ver
    Excel 2010
    Posts
    147

    Re: Unprotecting a sheet to run a macro

    Hi Ron,

    Cheers for that. I will certainly give it a go. If im struggling i will let you know. Thanks again,
    Chemist

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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