Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Abes
 
Posts: n/a
Default Unprotect Cells depending on Cell value

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   Report Post  
Junior Member
 
Location: Washington, DC
Posts: 16
Default

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:
Originally Posted by Abes
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
  #3   Report Post  
Abes
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cell color index comparison MINAL ZUNKE New Users to Excel 1 June 30th 05 07:11 AM
Adding contents of one cell to a range of cells. CLJinVA Excel Worksheet Functions 1 February 10th 05 10:19 PM
To safety merge cells without data destroyed, and smart unmerge! Kevin Excel Discussion (Misc queries) 0 December 30th 04 07:17 AM
Heps to design Locked/Unlocked cells in protected worksheet Kevin Excel Discussion (Misc queries) 0 December 30th 04 07:09 AM
Convert data of cells to any type: Number, Date&Time, Text Kevin Excel Discussion (Misc queries) 0 December 30th 04 06:55 AM


All times are GMT +1. The time now is 09:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"