Adding a click button that won't let you proceed to other worksheets unless you Agree to T&Cs

AliG999

New Member
Joined
Nov 6, 2017
Messages
20
Hi

I hope you can help I'm looking to introduce a front page to a worksheet which users must agree (tick box or click button) to the T&C's before they can look at subsequent sheets.

I know how to add buttons etc but not sure how to add the security feature.

Any help would be gratefully appreciated!

Alison
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Alison,

Welcome to the Board.

One approach would be to hide all the sheets except the front page when the workbook is opened, then present the user with a message box containing the terms and conditions, and if agreed to, unhide the sheets.

Code:
Private Sub Workbook_Open()
Dim ws As Worksheet
Dim agree As Integer

For Each ws In ThisWorkbook.Worksheets
    If ws.Name <> "Sheet1" Then ws.Visible = xlSheetVeryHidden 'Change "Sheet1" to the name of your front page sheet
Next ws

agree = MsgBox(prompt:="Paste your terms and conditions between these quotation marks." & vbCrLf & vbCrLf & "Do you agree with the Terms & Conditions?", Title:="Agreement", Buttons:=vbYesNo + vbQuestion)
If agree = vbYes Then
    For Each ws In ThisWorkbook.Worksheets
        ws.Visible = xlSheetVisible
    Next ws
End If
End Sub

The code should be pasted into the ThisWorkbook module.

Please note that this kind of security is not very secure; anyone that can open the vbe can unhide the sheets.

Cheers,

tonyyy
 
Upvote 0

Forum statistics

Threads
1,215,200
Messages
6,123,612
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top