Excel Startup Cells
Excel Startup Cells
(OP)
Hi,
Here is my problem:
I have an excel workbook with 3 sheets. I need to know what the code would be in order to specify specific startup cells with in each individual sheet.
Once this has been determined, I then need to know what code would require a user to enter data on the above mentioned cells. (IE: They are being forced to enter the dataon these startup cells, before continuing with the rest of the individual sheet.)
All three cells from each of the worksheets is a drop down box (not combo box).
Please advise as to the direction I need to take.
Thank you for your time.
Here is my problem:
I have an excel workbook with 3 sheets. I need to know what the code would be in order to specify specific startup cells with in each individual sheet.
Once this has been determined, I then need to know what code would require a user to enter data on the above mentioned cells. (IE: They are being forced to enter the dataon these startup cells, before continuing with the rest of the individual sheet.)
All three cells from each of the worksheets is a drop down box (not combo box).
Please advise as to the direction I need to take.
Thank you for your time.





RE: Excel Startup Cells
Private Sub Workbook_Open()
Sheet1.EnableSelection = xlUnlockedCells
Sheet2.EnableSelection = xlUnlockedCells
Sheet3.EnableSelection = xlUnlockedCells
End Sub
This will force your user to select only the unlocked cells. Sheet1, Sheet2 etc. are the code names for each sheet that has cell restriction.
Next protect each worksheet.
The hard part is deciding what criteria to use to unprotect the sheets after initialization of the start-up cells. One possible way would be to unprotect after a start-up has been changed. To do that enter the following code in the restricted sheet. Sheet1 for example
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Me.Range("B2,B4,B6")) Is Nothing Then Exit Sub
Me.Unprotect "<pasword>"
End Sub
The last bit is to set protection when the workbook is saved
add code to workbook pane as follows:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheet1.Protect
End Sub
RE: Excel Startup Cells
Hope this helps.
Mike