+ Reply to Thread
Results 1 to 3 of 3

Need help creating a macro to clear cells after a date, but the sheet is password protect

  1. #1
    Registered User
    Join Date
    07-22-2018
    Location
    Abu Dhabi
    MS-Off Ver
    Office 2016
    Posts
    9

    Need help creating a macro to clear cells after a date, but the sheet is password protect

    Hello,

    I need help creating a macro that will delete or clear a range of cells after a calendar date in a cell; however, the sheet is password protected so it will need to unlock the sheet before clearing the cells. I enclosed an example of a spreadsheet with the calendar date in cell 3A, but any spreadsheet could apply.

    Thank you!

    TC
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    6,720

    Re: Need help creating a macro to clear cells after a date, but the sheet is password prot

    Right Click on the sheet name at the bottom of excel and select view code

    Paste this into the module that opens and close it. NB I have assumed that the password is Test

    Please Login or Register  to view this content.
    Please Avoid Joining My List Of Blocked Users by:

    Saying Please and Thank you.

    Making requests not demands.

    Checking back on your post. I will not edit any post after 4 days.

    Marking threads as closed once your issue is resolved. How? The tools at the top

    Any reputation (*) points appreciated. None of us gets paid here.

    If you found someone's input useful, please take a second to click the * at the bottom left to let them know

  3. #3
    Registered User
    Join Date
    07-22-2018
    Location
    Abu Dhabi
    MS-Off Ver
    Office 2016
    Posts
    9

    Re: Need help creating a macro to clear cells after a date, but the sheet is password prot

    Hi mehmetcik,

    Thank you so much for the help, but the macro doesn't seem to work for a particular date. I tried several methods, but can't get the macro to delete based on a specific date. Any ideas?

    Private Sub Worksheet_Activate()
    If Range("A3").Value = 11 / 11 / 2019 Then
    ActiveSheet.Unprotect ("test")
    Range("B3:C12").Clear
    ActiveSheet.Protect ("test")
    End If
    End Sub

+ 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