Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Hi,
I would like to know if I am able to protect and unprotect a range of cells based on the date in another cell. For example: Cells N13:N22 are for a period between 21Aug and 23Aug and Cells N27:N37 are for a period between 25 Aug and 27 Aug. Today's date would be in Cell A1. I wish to be able to unprotect Cells N13:N22 when Cell A1's value is equal/greater than to 21Aug and re-protect them on 24Aug. Thanks in advance ----------- Abes Western Australia |
#2
![]() |
|||
|
|||
![]()
Abes,
Use this macro (replace GT and LT with appropriate Greater Than and Less Than symbols) where values to be evaluated and protected are in column "N" and your start and end dates are in A1 and A2, respectively: BEGIN MACRO -------------------- Sub protectdate() For Each Item In ActiveSheet.Range("N:N") If Item.Value GT= Range("a1").Value And Item.Value LT= Range("a2").Value Then Item.Locked = False Else Item.Locked = True End If Next End Sub -------------------- END MACRO Knightly Quote:
|
#3
![]() |
|||
|
|||
![]()
Sirknightly,
Thanks for the assistance, I will modify my spreadsheet to be able to incorporate something along the lines of your suggestion. -- Cheers Abes "sirknightly" wrote: Abes, Use this macro (replace GT and LT with appropriate Greater Than and Less Than symbols) where values to be evaluated and protected are in column "N" and your start and end dates are in A1 and A2, respectively: BEGIN MACRO -------------------- Sub protectdate() For Each Item In ActiveSheet.Range("N:N") If Item.Value GT= Range("a1").Value And Item.Value LT= Range("a2").Value Then Item.Locked = False Else Item.Locked = True End If Next End Sub -------------------- END MACRO Knightly Abes Wrote: Hi, I would like to know if I am able to protect and unprotect a range of cells based on the date in another cell. For example: Cells N13:N22 are for a period between 21Aug and 23Aug and Cells N27:N37 are for a period between 25 Aug and 27 Aug. Today's date would be in Cell A1. I wish to be able to unprotect Cells N13:N22 when Cell A1's value is equal/greater than to 21Aug and re-protect them on 24Aug. Thanks in advance ----------- Abes Western Australia -- sirknightly |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
cell color index comparison | New Users to Excel | |||
Adding contents of one cell to a range of cells. | Excel Worksheet Functions | |||
To safety merge cells without data destroyed, and smart unmerge! | Excel Discussion (Misc queries) | |||
Heps to design Locked/Unlocked cells in protected worksheet | Excel Discussion (Misc queries) | |||
Convert data of cells to any type: Number, Date&Time, Text | Excel Discussion (Misc queries) |