+ Reply to Thread
Results 1 to 4 of 4

Unlocked Cells in Table based if date criteria met

  1. #1
    Forum Contributor
    Join Date
    01-25-2021
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    144

    Unlocked Cells in Table based if date criteria met

    I have a workbook with all months of the year. I am trying to lock certain cells within tables based on today's date. So essentially, if today's date is not the same month as listed in "A1", all cells remain locked. However if today is in the same month as "A1", I would like columns "Date Completed" & "Comments" unlocked. The table can shrink or expand so the solution must be dynamic. Also.....sheets are protected.

    With the help of others on this site, I was able to created below code......but as you can see it is a mess:

    Sub Workbook_SheetActivate(ByVal Sh As Object)

    If DateSerial(Month(Range("A1").Value)) <> DateValue(Now) Then
    ActiveSheet.Unprotect Password:="password"
    ListObjects("Adv_Feb").ListColumns("Date Completed").Range.Locked = False
    ListObjects("Adv_Feb").ListColumns("Comments").Range.Locked = False
    ActiveSheet.Protect Password:="password"
    End If

    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,775

    Re: Unlocked Cells in Table based if date criteria met

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Forum Contributor
    Join Date
    01-25-2021
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    144

    Re: Unlocked Cells in Table based if date criteria met

    Excellent Mumps!

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,775

    Re: Unlocked Cells in Table based if date criteria met

    Glad it worked out.

+ 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. Replies: 1
    Last Post: 04-09-2021, 11:09 AM
  2. Based on condition cells to be unlocked
    By somusas in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2015, 12:00 AM
  3. Replies: 5
    Last Post: 03-31-2015, 03:38 AM
  4. [SOLVED] Index Match Based on One Date Criteria, Table Contains Beginning Date and End Date
    By jcox1953 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-09-2014, 02:41 PM
  5. [SOLVED] Max Date from table based on two criteria
    By Slickdog in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-29-2013, 06:25 AM
  6. Replies: 1
    Last Post: 09-30-2012, 03:01 PM
  7. [SOLVED] Moving from unlocked cells to unlocked cells in an excel form
    By Stacey Lee in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-24-2006, 03:50 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