View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Richard Buttrey Richard Buttrey is offline
external usenet poster
 
Posts: 296
Default Excel: how do I set page3 to be locked until page 1, 2 are solved

On Fri, 12 Aug 2005 10:07:02 -0700, "Fillius Furral" <Fillius
wrote:

I'm making a test for a project and I've got three pages.
I want the last page to be locked until the first two are solved.
So: 1 and 2 are free to use (pages of questions) and I want 3 (page of
answers) to be locked until 1 and 2 are filled out. (I figure I need te
coordinates of the answer fields and such, but I can't figure out how.)



I think the approach I'd adopt is as follows. It assumes you can test
the condition of a cell such that you know an answer has been given.
For instance the answer cells may all start out as being blank.

Name the third sheet "Answers", and in VBA set the Visible property to
xlSheetVeryHidden

Assuming you have say 4 answer cells dotted around each of sheets 1 &
2, say A1, C1, B3, C4, in say E1:E4 enter the formulae
=IF(A1<"",0,1)
=IF(C1<"",0,1)
=IF(B3<"",0,1)
=IF(c4<"",0,1)

Then in say F1 sum the values E1:E4 on sheet 1 and say E1:E4 on sheet
2. This means that if all the answers have been completed, the value
of F1 will be zero. Anything else will mean a total of at least 1.

Then in a macro enter the following procedure

Sub UnhideSheet3()
If Range("F1") = 0 Then Worksheets("answers").Visible = True
End Sub

Now put a button on sheet 1 and/or 2 with a caption of "Display
answers" and link it to the UnhideSheet3 macro.

When the user presses this button, the Answers sheet will only display
when all answers have been completed.

It's not foolproof of course, since a VBA savvy user would be able to
open the VBA window and display the sheet manually.

HTH





__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________