PC Review


Reply
Thread Tools Rate Thread

Auto Protecting cells & auto filling date

 
 
ccarmock
Guest
Posts: n/a
 
      29th Sep 2005

I wonder if anyone can tell me if it is possible to auto proect cells
after data has been entered?

Basically I have a spreadsheet that has two levels of protection - some
cells are password protected and others available for all to enter data
into.

What I would like to achieve is once data has been entered into a row
in the editable area that row becomes part of the password protected
area automatically.

Also is it possible to use the NOW (or similar) function to populate
one cell with a date when another is filled?

Ie a log entry is made in column B. When some data is entered into
column B cthe corresponding entry in column A gets filled with todays
date.

Any help much appreciated.

Regards
Clive


--
ccarmock
------------------------------------------------------------------------
ccarmock's Profile: http://www.excelforum.com/member.php...o&userid=27670
View this thread: http://www.excelforum.com/showthread...hreadid=471820

 
Reply With Quote
 
 
 
 
=?Utf-8?B?d2lkbWFu?=
Guest
Posts: n/a
 
      29th Sep 2005
I can't answer the first part, but the second part is easy
just enter into a1 =IF(b1=0,0,NOW())
format a1 as a date
in tools/options uncheck show zeros

"ccarmock" wrote:

>
> I wonder if anyone can tell me if it is possible to auto proect cells
> after data has been entered?
>
> Basically I have a spreadsheet that has two levels of protection - some
> cells are password protected and others available for all to enter data
> into.
>
> What I would like to achieve is once data has been entered into a row
> in the editable area that row becomes part of the password protected
> area automatically.
>
> Also is it possible to use the NOW (or similar) function to populate
> one cell with a date when another is filled?
>
> Ie a log entry is made in column B. When some data is entered into
> column B cthe corresponding entry in column A gets filled with todays
> date.
>
> Any help much appreciated.
>
> Regards
> Clive
>
>
> --
> ccarmock
> ------------------------------------------------------------------------
> ccarmock's Profile: http://www.excelforum.com/member.php...o&userid=27670
> View this thread: http://www.excelforum.com/showthread...hreadid=471820
>
>

 
Reply With Quote
 
=?Utf-8?B?d2lkbWFu?=
Guest
Posts: n/a
 
      29th Sep 2005
The only problem with NOW is that it always will reset to the day it is
opened or printed

"widman" wrote:

> I can't answer the first part, but the second part is easy
> just enter into a1 =IF(b1=0,0,NOW())
> format a1 as a date
> in tools/options uncheck show zeros
>
> "ccarmock" wrote:
>
> >
> > I wonder if anyone can tell me if it is possible to auto proect cells
> > after data has been entered?
> >
> > Basically I have a spreadsheet that has two levels of protection - some
> > cells are password protected and others available for all to enter data
> > into.
> >
> > What I would like to achieve is once data has been entered into a row
> > in the editable area that row becomes part of the password protected
> > area automatically.
> >
> > Also is it possible to use the NOW (or similar) function to populate
> > one cell with a date when another is filled?
> >
> > Ie a log entry is made in column B. When some data is entered into
> > column B cthe corresponding entry in column A gets filled with todays
> > date.
> >
> > Any help much appreciated.
> >
> > Regards
> > Clive
> >
> >
> > --
> > ccarmock
> > ------------------------------------------------------------------------
> > ccarmock's Profile: http://www.excelforum.com/member.php...o&userid=27670
> > View this thread: http://www.excelforum.com/showthread...hreadid=471820
> >
> >

 
Reply With Quote
 
ccarmock
Guest
Posts: n/a
 
      29th Sep 2005

Yes I see what you mean - so every time I open the sheet the dates ar
updated.....

If the first time it triggers it coudl replace the formula with th
actual value that woudl achieve what I need...

--
ccarmoc
-----------------------------------------------------------------------
ccarmock's Profile: http://www.excelforum.com/member.php...fo&userid=2767
View this thread: http://www.excelforum.com/showthread.php?threadid=47182

 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      29th Sep 2005
ccarmock

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col B
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 2 Then
n = Target.Row
If Excel.Range("B" & n).Value <> "" Then
Excel.Range("A" & n).Value = Now
End If
End If
enditall:
Application.EnableEvents = True
End Sub

This is sheet event code.

Right-click on the sheet tab and "View Code".

Copy/paste the code into that module. As you enter data in column B, the date
will be placed in A on same row.


Gord Dibben Excel MVP

On Thu, 29 Sep 2005 14:38:30 -0500, ccarmock
<(E-Mail Removed)> wrote:

>
>Yes I see what you mean - so every time I open the sheet the dates are
>updated.....
>
>If the first time it triggers it coudl replace the formula with the
>actual value that woudl achieve what I need....


 
Reply With Quote
 
ccarmock
Guest
Posts: n/a
 
      30th Sep 2005

Hi - Many thanks that works perfectly!

I wonder if something similar could be used to modify the ranges used
to protect data in the worksheet?

Ie once data is entered into a cell in column B I woudl then like to
change that cell from being in a range that allows anyone to edit into
a range that is password protected.

Regards
Clive


--
ccarmock
------------------------------------------------------------------------
ccarmock's Profile: http://www.excelforum.com/member.php...o&userid=27670
View this thread: http://www.excelforum.com/showthread...hreadid=471820

 
Reply With Quote
 
ccarmock
Guest
Posts: n/a
 
      30th Sep 2005

One further question on this - when I lock the spreadsheet (as I don
want the date to be modified by the user, the system can no longe
update column A with the date of the change.

To achieve this I have column B set to allow Everyone to make change
while the rest of the sheet requires a password to edit ranges.

I guess I can get the Macro to turn off protection and turn it o
again? However would this mean storing the password in the Macro?
Again not an issue, but I would then need to be able to prevent th
user from looking at the Macro code to discover the password - is tha
possible?

Or alternatively is there the concept of allowing the 'SYSTEM
permission to update a range of cells, this might be a cleane
approach

--
ccarmoc
-----------------------------------------------------------------------
ccarmock's Profile: http://www.excelforum.com/member.php...fo&userid=2767
View this thread: http://www.excelforum.com/showthread.php?threadid=47182

 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      30th Sep 2005
ccarmock

Depending upon how sophisticated your users are and whether or not they enable
macros upon opening the workbook you can achieve most of what you want.

First, unlock columns A and B then protect the sheet with a password("justme")
is example only.

The Sub following will enter a date in column A and lock that cell in Column A
but leaving rest of column A unlocked.

B must remain unprotected in order for users to enter data.

Add the code below to the sheet module.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col B
'if a date is in A, it won't change when B is updated
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 2 Then
SHEETUNPROTECT
N = Target.Row
If Excel.Range("B" & N).Value <> "" _
And Excel.Range("A" & N).Value = "" Then
Excel.Range("A" & N).Value = Now
Excel.Range("A" & N).Locked = True
End If
End If
enditall:
Application.EnableEvents = True
SHEETPROTECT
End Sub

Now copy the following macros to a new general module in the workbook.

Sub SHEETPROTECT()
ActiveSheet.Protect Password:="justme", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
End Sub

Sub SHEETUNPROTECT()
ActiveSheet.Unprotect Password:="justme"
End Sub

Right-click on the workbook/project and select VBAProject Properties then
"Lock project for viewing"

You can password protect this module so prying eyes can't see it and obtain
the password("justme").

You now save the workbook and close Excel....the VBAProject locking won't come
into effect until Excel is closed out fully.

If the users enable macros and if no one of them knows how to crack a
VBAProject password, you should be good to go.


Gord


On Fri, 30 Sep 2005 12:30:06 -0500, ccarmock
<(E-Mail Removed)> wrote:

>
>One further question on this - when I lock the spreadsheet (as I dont
>want the date to be modified by the user, the system can no longer
>update column A with the date of the change.
>
>To achieve this I have column B set to allow Everyone to make changes
>while the rest of the sheet requires a password to edit ranges.
>
>I guess I can get the Macro to turn off protection and turn it on
>again? However would this mean storing the password in the Macro?
>Again not an issue, but I would then need to be able to prevent the
>user from looking at the Macro code to discover the password - is that
>possible?
>
>Or alternatively is there the concept of allowing the 'SYSTEM'
>permission to update a range of cells, this might be a cleaner
>approach.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto-filling cells from another sheet RichW Microsoft Excel Misc 1 28th Oct 2008 07:43 PM
Auto Correcting and Auto Filling Cells Arnold Microsoft Excel Programming 0 27th Feb 2008 10:35 PM
Auto filling in adjacent cells JPA888 Microsoft Excel Misc 5 29th Oct 2004 09:20 PM
Another question on Auto Filling Cells =?Utf-8?B?SiBQb3dlcnM=?= Microsoft Excel Misc 7 27th Sep 2004 12:25 PM
Bi-directional auto-filling cells Joe Microsoft Excel Worksheet Functions 1 3rd Sep 2004 08:06 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:02 AM.