Results 1 to 4 of 4

Unlocked Cells in Table based if date criteria met

Threaded View

  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

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