Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On my worksheet, if a user answers 'Yes' to cell C42, then I want to unhide
rows 43:48 and go to Cell C43 (the next unlocked cell); if they answer 'No' in cell C42, I want to hide and lock rows 43:48 and go to Cell C52 (which is the next unlocked cell after C48 assuming rows 43:48 are locked). Below is the code I have, but only part of it works.....if 'No' - it works fine; if the answer is 'Yes', the code does unhide rows 43:48, but takes the user to C52, instead of C43. I've tried 'select' and 'activate', but can't use because once 'yes' is entered in C42, they can't get back to C42 to change it back to 'no' if they want to. Can someone advise what I need to do to get the 'yes' portion working correctly? Option Explicit Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Range("C42").Value = "No" Then ActiveSheet.Unprotect Rows("43:48").Locked = True Rows("43:48").Hidden = True ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True ActiveSheet.EnableSelection = xlUnlockedCells End If If Range("C42").Value = "Yes" Then ActiveSheet.Unprotect Rows("43:48").Hidden = False Range("C43:K48").Locked = False ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True ActiveSheet.EnableSelection = xlUnlockedCells End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I lock a cell after data entry so entry can not be changed | Excel Discussion (Misc queries) | |||
Lock out data entry in a cell | Excel Discussion (Misc queries) | |||
Lock Cell After Data Entry | Excel Discussion (Misc queries) | |||
Lock cell entry | Excel Worksheet Functions | |||
Is there a way to lock out the format for the cell and still allow data entry and C&P? | New Users to Excel |