I am working on a macro to protect all sheets in a workbook. It will exit the sub if there are already sheets protected, which is a feature I want. However, it checks not only the active workbook but all sheets in any open workbooks for protection. Is there a way to specify only the sheets in the active workbook?

Here is part of my code:

```
For i = 1 To Worksheets.Count
If Worksheets(i).ProtectContents = True Then GoTo Error
Next
For Each s In ActiveWorkbook.Worksheets
s.Protect Password:=pass
Next
Exit Sub
Error: MsgBox "I think you have some sheets that are already protected. Please unprotect all sheets before using this function.", vbCritical, "Error"
End Sub

```