Thread: Excel
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
JLatham JLatham is offline
external usenet poster
 
Posts: 3,365
Default Excel

This would have to be done in the Worksheet events code - I'd use the
_Deactivate() event. Here's sample code of how it might work (change cell
address - also make sure that cell is not Locked before Protecting the sheet,
so that people may enter a value into it)..

To place this code into proper location in the workbook: go to the sheet
this is to happen to and right-click the sheet's name tab and choose [View
Code] from the list. Copy and paste this code into the module that appears,
then modify the code as needed. Save the workbook, or close and 'save
changes'.

Private Sub Worksheet_Deactivate()
If IsEmpty(Range("A1")) Then
'tell why they can't leave!
MsgBox "You must enter a value into cell A1."
'force back to this sheet
Worksheets(Me.Name).Select
'point out cell needing entry in it
Range("A1").Select
End If
End Sub



"Andy" wrote:

I want to set up a worksheet so you have to enter a value in a cell before
you can move to the next worksheet. This worksheet is also has protected
cells. How and/or can this be done?