LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default After Entry - Lock and Go to Certain Cell

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
 
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
Can I lock a cell after data entry so entry can not be changed Verlinde Excel Discussion (Misc queries) 3 April 22nd 10 07:59 PM
Lock out data entry in a cell DShaver Excel Discussion (Misc queries) 1 August 27th 09 07:29 PM
Lock Cell After Data Entry Ripper Excel Discussion (Misc queries) 1 February 28th 06 08:17 PM
Lock cell entry Sprankler Excel Worksheet Functions 1 November 17th 05 03:50 PM
Is there a way to lock out the format for the cell and still allow data entry and C&P? Marc New Users to Excel 1 April 4th 05 07:50 AM


All times are GMT +1. The time now is 10:02 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"