Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Is it possible to have code that protects cells based on an i statement. I have the following code that unhides certain rows if th user selects "Units" from the ComboBox. I would like other cells to b protected if the user selects "Units" and then unprotect if no "Units". Private Sub ComboBox1_Change() If Worksheets("Sheet1").Range("J18").Value = "Units" Then Rows("25:28").Select Selection.EntireRow.Hidden = True Rows("25:28").Select Selection.EntireRow.Hidden = False End If If Worksheets("Sheet1").Range("J18").Value = "Input" Then Rows("25:28").Select Selection.EntireRow.Hidden = True Rows("25:25").Select Selection.EntireRow.Hidden = False Range("B13").Select End If Thanks -- bforster ----------------------------------------------------------------------- bforster1's Profile: http://www.excelforum.com/member.php...fo&userid=1177 View this thread: http://www.excelforum.com/showthread.php?threadid=26466 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sure. In the same code, unprotect the sheet. Toggle the locked property of
the cells, protect the sheet. -- Regards, Tom Ogilvy "bforster1" wrote in message ... Is it possible to have code that protects cells based on an if statement. I have the following code that unhides certain rows if the user selects "Units" from the ComboBox. I would like other cells to be protected if the user selects "Units" and then unprotect if not "Units". Private Sub ComboBox1_Change() If Worksheets("Sheet1").Range("J18").Value = "Units" Then Rows("25:28").Select Selection.EntireRow.Hidden = True Rows("25:28").Select Selection.EntireRow.Hidden = False End If If Worksheets("Sheet1").Range("J18").Value = "Input" Then Rows("25:28").Select Selection.EntireRow.Hidden = True Rows("25:25").Select Selection.EntireRow.Hidden = False Range("B13").Select End If Thanks. -- bforster1 ------------------------------------------------------------------------ bforster1's Profile: http://www.excelforum.com/member.php...o&userid=11771 View this thread: http://www.excelforum.com/showthread...hreadid=264663 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Is there a way to disable a macro based on the value of a cell? | Excel Discussion (Misc queries) | |||
enable/disable button based on cell value | Excel Discussion (Misc queries) | |||
Disable Tools Protection Protect Sheet for all users but one | Excel Discussion (Misc queries) | |||
Conditional formatting based on decision to enable/disable macros? | Excel Discussion (Misc queries) | |||
protect cells based on another cell | Excel Worksheet Functions |