Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
protect cells after listbox selection
How can I protect a range of cells(Ex. A3:A6) after I pick a value from a
listbox. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
protect cells after listbox selection
Chay
This assumes you have all cells unlocked and sheet is protected with the password "justme" Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo enditall Application.EnableEvents = False If Not Intersect(Target, Me.Range("B6")) Is Nothing Then ActiveSheet.Unprotect Password:="justme" With Target If .Value = 3 Then Range("A3:A6").Cells.Locked = True End If End With End If enditall: Application.EnableEvents = True ActiveSheet.Protect Password:="justme", DrawingObjects:=True, _ Contents:=True, Scenarios:=True End Sub This is event code. Right-click on the sheet tab and "View Code" Copy/paste into that sheet module. Change Value = 3 to whatever value you will get from dropdown in B6 Gord Dibben MS Excel MVP On Thu, 30 Nov 2006 00:07:00 -0800, Chay wrote: How can I protect a range of cells(Ex. A3:A6) after I pick a value from a listbox. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
protect cells after listbox selection
Thank you Gord Gibben for your code. Both of you guys helped me a lot. You
are pure geniuses. Thanks a million!!!!!! "Gord Dibben" wrote: Chay This assumes you have all cells unlocked and sheet is protected with the password "justme" Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo enditall Application.EnableEvents = False If Not Intersect(Target, Me.Range("B6")) Is Nothing Then ActiveSheet.Unprotect Password:="justme" With Target If .Value = 3 Then Range("A3:A6").Cells.Locked = True End If End With End If enditall: Application.EnableEvents = True ActiveSheet.Protect Password:="justme", DrawingObjects:=True, _ Contents:=True, Scenarios:=True End Sub This is event code. Right-click on the sheet tab and "View Code" Copy/paste into that sheet module. Change Value = 3 to whatever value you will get from dropdown in B6 Gord Dibben MS Excel MVP On Thu, 30 Nov 2006 00:07:00 -0800, Chay wrote: How can I protect a range of cells(Ex. A3:A6) after I pick a value from a listbox. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Password protect cells | Excel Worksheet Functions | |||
Linking Groups of cells between workbooks | Excel Discussion (Misc queries) | |||
show the sum of an arbitary selection of cells | Excel Worksheet Functions | |||
Protect Cells ??? | Excel Discussion (Misc queries) | |||
How do I copy a LARGE selection of cells from Excel to powerpoint? | Excel Discussion (Misc queries) |