View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mark Ivey[_2_] Mark Ivey[_2_] is offline
external usenet poster
 
Posts: 171
Default lock a workbook until certain cells are filled

Here is one you can try for a starter....

From your worksheet... press ALT + F11
Double click the worksheet you want this applied to in the Project Toolbar.

Once you have data in cells A1, B1, C1, D1, and E1... it will unlock your
sheet (provided you don't have a password on it).

Mark Ivey





Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Range("A1").Value < "" And Range("B1").Value < "" And _
Range("C1").Value < "" And Range("D1").Value < "" And _
Range("E1").Value < "" Then

Sheets("Sheet1").Unprotect

MsgBox "Your worksheet is now unlocked", vbOKOnly

End If

End Sub









"batmanz" wrote in message
...
I have a workbook that I would like to have certain cells filled (as in:
name, address, phone, etc) before you are able to just start entering
other
information. what would be the direction to use? a macro? or an excel
function. i found one example where cells had to be filled before you were
allowed to save the workbook. that involved writing some code at the
location
of the excel sign next to the file button.
I already have a macro to do a "save as" using the cells, however, the
cells
do not have to be filled to use the function. (it just defaults to a
date).
i don't know enough about VBA to write something on my own. i'm getting
pretty good at copying other examples and applying them to my application.
thx