PC Review


Reply
Thread Tools Rate Thread

Conditional unlock

 
 
johnsail
Guest
Posts: n/a
 
      31st Mar 2008
Hi
Is it possible to unlock a cell dependent on a specific value being entered
in anther cell in the same row?
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      31st Mar 2008
Hi,

You can doo it using a change event. This check B1 which must be unlocked
and if the value changes to 999 then A1 becomes unlocked

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("B1")) Is Nothing Then
If Target.Value = 999 Then
ActiveSheet.Unprotect Password:="mypass"
Range("A1").Locked = False
Else
Range("A1").Locked = True
End If
ActiveSheet.Protect Password:="mypass"
End If
End Sub

Mike

"johnsail" wrote:

> Hi
> Is it possible to unlock a cell dependent on a specific value being entered
> in anther cell in the same row?

 
Reply With Quote
 
johnsail
Guest
Posts: n/a
 
      31st Mar 2008
Hi Mike
Many thanks for the quick response. The routine "does what it says on the
tin" and I have tried to adapt it to do all that I need it to do.

However I have failed miserably - I have been unable to work out what is
basically going on in your routine.

If you are willing to help further I will spell out exactly what is required:-

1 In each row all cells (A to J) are defined as locked EXCEPT B, C & D.
2 If "X" is entered into C then E should be unlocked to allow fdata entry.
3 If any other data is entered into C then J should be unlocked for data
entry.
4 If C is changed from "X" to "non X" or vice versa then the appropriate
lock / unlock needs to be applied.
5 If the value in C is subsequently deleted then both E and J need to be
locked.

To further complicate things - whenever J is locked it needs to have the
formula inserted that was in the cell to start with. My thoughts on this are
to have a hidden cell (K) that contains a copy of the formula that can be
copied back.

I sincerely hope that you can help.

Regards

John
"Mike H" wrote:

> Hi,
>
> You can doo it using a change event. This check B1 which must be unlocked
> and if the value changes to 999 then A1 becomes unlocked
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
> If Not Intersect(Target, Range("B1")) Is Nothing Then
> If Target.Value = 999 Then
> ActiveSheet.Unprotect Password:="mypass"
> Range("A1").Locked = False
> Else
> Range("A1").Locked = True
> End If
> ActiveSheet.Protect Password:="mypass"
> End If
> End Sub
>
> Mike
>
> "johnsail" wrote:
>
> > Hi
> > Is it possible to unlock a cell dependent on a specific value being entered
> > in anther cell in the same row?

 
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
Conditional unlock for cells Selva Microsoft Excel Misc 2 1st Apr 2010 01:57 PM
Conditional unlock for cells Selva Microsoft Excel Worksheet Functions 0 19th Jan 2010 11:45 PM
conditional unlock =?Utf-8?B?am9obnNhaWw=?= Microsoft Excel Misc 3 22nd Oct 2007 04:24 PM
how do i password protect an .xls file? how do i unlock it for automation. e.g. want to unlock and access a .xls from another .xls macro. Daniel Microsoft Excel Worksheet Functions 1 24th Jun 2005 02:59 PM
how do i password protect an .xls file? how do i unlock it for automation. e.g. want to unlock and access a .xls from another .xls macro. Daniel Microsoft Excel Discussion 1 24th Jun 2005 01:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:01 PM.