Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do i lock a cell? to save formula or function in it? | Excel Discussion (Misc queries) | |||
I want to copy a formula down several rows and lock a cell ref. | Excel Discussion (Misc queries) | |||
In creating a spreadsheet how can I lock a formula cell only? | New Users to Excel | |||
How do I lock a formula in a cell in an Excel worksheet? | Excel Discussion (Misc queries) | |||
How do I lock a formula in a cell in an Excel worksheet? | Excel Worksheet Functions |