Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default formula to lock cell?

Can you use a validation formula to lock a cell? If so could you give me an
example of how to write it?

Thanks in advance,
MIke
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default formula to lock cell?

No you can't use validation to lock a cell


--


Regards,


Peo Sjoblom


"MIke" wrote in message
...
Can you use a validation formula to lock a cell? If so could you give me
an
example of how to write it?

Thanks in advance,
MIke



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default formula to lock cell?

As Peo mentioned..........Formulas cannot lock cells.

DV can't lock cells.

Conditional formatting can't lock cells.

You would be best use VBA event code.

If you describe what you need locking and when, someone could supply some code.


Gord Dibben MS Excel MVP

On Wed, 24 Oct 2007 09:48:08 -0700, MIke wrote:

Can you use a validation formula to lock a cell? If so could you give me an
example of how to write it?

Thanks in advance,
MIke


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default formula to lock cell?

Gord,

I have a formula in Column O7:O37. I need cells B7:N37 to lock when the
value from the formula exceeds a certain threshold.

Thanks for the help,
Mike

"Gord Dibben" wrote:

As Peo mentioned..........Formulas cannot lock cells.

DV can't lock cells.

Conditional formatting can't lock cells.

You would be best use VBA event code.

If you describe what you need locking and when, someone could supply some code.


Gord Dibben MS Excel MVP

On Wed, 24 Oct 2007 09:48:08 -0700, MIke wrote:

Can you use a validation formula to lock a cell? If so could you give me an
example of how to write it?

Thanks in advance,
MIke



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default formula to lock cell?

Assuming all cells are set to "unlocked" to begin with and sheet is password
protected

Private Sub Worksheet_Calculate()
Dim myCell As Range
On Error GoTo ws_exit:
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="justme"
For Each myCell In Range("O7:O37")

If myCell.Value 8 Then
myCell.Offset(0, -13).Locked = True

End If
Next myCell
ActiveSheet.Protect Password:="justme"

ws_exit:
Application.EnableEvents = True
End Sub


Gord


On Thu, 25 Oct 2007 04:55:01 -0700, MIke wrote:

Gord,

I have a formula in Column O7:O37. I need cells B7:N37 to lock when the
value from the formula exceeds a certain threshold.

Thanks for the help,
Mike

"Gord Dibben" wrote:

As Peo mentioned..........Formulas cannot lock cells.

DV can't lock cells.

Conditional formatting can't lock cells.

You would be best use VBA event code.

If you describe what you need locking and when, someone could supply some code.


Gord Dibben MS Excel MVP

On Wed, 24 Oct 2007 09:48:08 -0700, MIke wrote:

Can you use a validation formula to lock a cell? If so could you give me an
example of how to write it?

Thanks in advance,
MIke






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default formula to lock cell?

Gord,

The code you gave me works but it only locks the cell 13 spots from the
target cell. Is there a way to lock all 13 cells to the left of the target?
Do you have any suggestions?

Thanks for your help,
Mike

"Gord Dibben" wrote:

Assuming all cells are set to "unlocked" to begin with and sheet is password
protected

Private Sub Worksheet_Calculate()
Dim myCell As Range
On Error GoTo ws_exit:
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="justme"
For Each myCell In Range("O7:O37")

If myCell.Value 8 Then
myCell.Offset(0, -13).Locked = True

End If
Next myCell
ActiveSheet.Protect Password:="justme"

ws_exit:
Application.EnableEvents = True
End Sub


Gord


On Thu, 25 Oct 2007 04:55:01 -0700, MIke wrote:

Gord,

I have a formula in Column O7:O37. I need cells B7:N37 to lock when the
value from the formula exceeds a certain threshold.

Thanks for the help,
Mike

"Gord Dibben" wrote:

As Peo mentioned..........Formulas cannot lock cells.

DV can't lock cells.

Conditional formatting can't lock cells.

You would be best use VBA event code.

If you describe what you need locking and when, someone could supply some code.


Gord Dibben MS Excel MVP

On Wed, 24 Oct 2007 09:48:08 -0700, MIke wrote:

Can you use a validation formula to lock a cell? If so could you give me an
example of how to write it?

Thanks in advance,
MIke




  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default formula to lock cell?

Try this version Mike.

Private Sub Worksheet_Calculate()
Dim myCell As Range
On Error GoTo ws_exit:
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="justme"
For Each myCell In Range("O7:O37")
If myCell.Value 8 Then
Range(myCell.Offset(0, -1), myCell.Offset(0, -13)).Locked = True
Else
Range(myCell.Offset(0, -1), myCell.Offset(0, -13)).Locked = False
End If
Next myCell
ActiveSheet.Protect Password:="justme"

ws_exit:
Application.EnableEvents = True
End Sub


Gord

On Thu, 1 Nov 2007 05:24:02 -0700, MIke wrote:

Gord,

The code you gave me works but it only locks the cell 13 spots from the
target cell. Is there a way to lock all 13 cells to the left of the target?
Do you have any suggestions?

Thanks for your help,
Mike

"Gord Dibben" wrote:

Assuming all cells are set to "unlocked" to begin with and sheet is password
protected

Private Sub Worksheet_Calculate()
Dim myCell As Range
On Error GoTo ws_exit:
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="justme"
For Each myCell In Range("O7:O37")

If myCell.Value 8 Then
myCell.Offset(0, -13).Locked = True

End If
Next myCell
ActiveSheet.Protect Password:="justme"

ws_exit:
Application.EnableEvents = True
End Sub


Gord


On Thu, 25 Oct 2007 04:55:01 -0700, MIke wrote:

Gord,

I have a formula in Column O7:O37. I need cells B7:N37 to lock when the
value from the formula exceeds a certain threshold.

Thanks for the help,
Mike

"Gord Dibben" wrote:

As Peo mentioned..........Formulas cannot lock cells.

DV can't lock cells.

Conditional formatting can't lock cells.

You would be best use VBA event code.

If you describe what you need locking and when, someone could supply some code.


Gord Dibben MS Excel MVP

On Wed, 24 Oct 2007 09:48:08 -0700, MIke wrote:

Can you use a validation formula to lock a cell? If so could you give me an
example of how to write it?

Thanks in advance,
MIke





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
how do i lock a cell? to save formula or function in it? Ajay Upmaneu Excel Discussion (Misc queries) 1 July 4th 06 10:17 AM
I want to copy a formula down several rows and lock a cell ref. abcdbaker Excel Discussion (Misc queries) 3 November 24th 05 02:48 AM
In creating a spreadsheet how can I lock a formula cell only? Frozen Bob New Users to Excel 3 September 21st 05 12:21 PM
How do I lock a formula in a cell in an Excel worksheet? katydyd Excel Discussion (Misc queries) 1 July 6th 05 09:54 PM
How do I lock a formula in a cell in an Excel worksheet? katydyd Excel Worksheet Functions 1 July 6th 05 09:39 PM


All times are GMT +1. The time now is 05:54 PM.

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"