Thomas Almond
Thomas Almond

Reputation: 30

Excel VBA - how to prevent a user changing worksheets conditional on certain criteria

I'm currently creating a workbook which has an input tab, all of it's data flowing through into later tabs. I want to prevent a user from moving onto any other tabs until all of the relavent information is filled in on the input sheet.

I'm currently trying to use the workbook_sheetactivate event but have spent a lot of time going between this and worksheet_change event, neither of which I can get working properly. Any help would be greatly appreciated.

Upvotes: 0

Views: 3087

Answers (1)

Petay87
Petay87

Reputation: 1773

If you don't want to use forms then I would suggest adding code similar to the following to each sheet:

Private Sub Worksheet_Activate()
    If Worksheets("Sheet1").Range("A1").Value = "" Then
        Worksheets("Sheet1").Select
    End If
End Sub

Obviously you will need to change the sheet names, range and value but I'm sure you get the idea.

Upvotes: 1

Related Questions