Can I use "Clear Sheet" macro on protected cells?

Posted on 2011-04-21
Last Modified: 2012-05-11
I have an inspection sheet where you check the boxes, print and save ~~  I need the sheet protected so the format can't be altered.    I have a "clear sheet" macro that works great until I protect the sheet ~~  Can I put the password in the macro to allow it to clear??  Thanks
Question by:SRMoxy
    LVL 85

    Accepted Solution

    const strPassword as string = "my password"
    ActiveSheet.Unprotect password:=strpassword
    ' rest of your code here
    ActiveSheet.protect password:=strpassword

    Open in new window

    for example.

    Author Closing Comment

    Thanks a bunch!

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
    Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
    This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now