Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default MACRO for cell protect after a date is reached

Hello,

In an sheet I need that after a date is reached, some cells to be
protected from writing.

For example: today is 11.03,2009 and after 31.03.2009 some cells
(example A1:G1, A2:G2 etc) from the sheet will be protected for
writing.

I have the following code, but you can unprotect the cells from the
review tab - so this doesnt help me at all:


Private Sub Worksheet_Change(ByVal Target As Range)
Range("D6").FormulaR1C1 = "=TODAY()"
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

final_date = Cells(4, 4).Value
current_date = Cells(6, 4).Value
If current_date final_date Then ActiveSheet.Protect
DrawingObjects:=True, Contents:=True, Scenarios:=True
If current_date <= final_date Then ActiveSheet.Unprotect

End Sub

can you please advise me in this issue? How to protect the cells with
a psswd?

Thank you,
Andrei







  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default MACRO for cell protect after a date is reached

Hi

ActiveSheet.Protect Password:="JustMe", DrawingObjects:=True,
Contents:=True, Scenarios:=True

ActiveSheet.UnProtect Password:="JustMe"

Regards,
Per

skrev i meddelelsen
...
Hello,

In an sheet I need that after a date is reached, some cells to be
protected from writing.

For example: today is 11.03,2009 and after 31.03.2009 some cells
(example A1:G1, A2:G2 etc) from the sheet will be protected for
writing.

I have the following code, but you can unprotect the cells from the
review tab - so this doesnt help me at all:


Private Sub Worksheet_Change(ByVal Target As Range)
Range("D6").FormulaR1C1 = "=TODAY()"
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

final_date = Cells(4, 4).Value
current_date = Cells(6, 4).Value
If current_date final_date Then ActiveSheet.Protect
DrawingObjects:=True, Contents:=True, Scenarios:=True
If current_date <= final_date Then ActiveSheet.Unprotect

End Sub

can you please advise me in this issue? How to protect the cells with
a psswd?

Thank you,
Andrei








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
Send email notice when date reached in an excel spreadsheet Tbledsoe Excel Programming 2 October 31st 06 07:04 PM
How do I run a macro when a pre-determined time has been reached . NAMATA Excel Discussion (Misc queries) 1 April 19th 06 08:12 PM
Repeat Macro until Empty Cell Reached clpncsg Excel Programming 19 October 1st 05 02:14 AM
Excel VBA - macro to recalculate random numbers until target reached gregaw Excel Programming 2 May 2nd 04 04:58 PM
HOW ? Running a different Macro if value reached bertieBassett Excel Programming 3 November 3rd 03 11:23 AM


All times are GMT +1. The time now is 03:00 AM.

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

About Us

"It's about Microsoft Excel"