I have a serious problem which i can not solve. I have buildt a simple
password login macro in excel making it possible to give different
users different information.

The macro works fine when I made it, however After I save it and
restart it again the above message pops up, when I start the Macro.

the macro I have made look like this,
I seems like the macro crash on this line ( Sheets(i).Visible =
xlSheetVeryHidden)

Private Sub showAll()
Dim i As Integer
For i = 2 To Sheets.Count
Sheets(i).Visible = xlSheetVisible
Next i
End Sub

Private Sub CommandButton1_Click()
Dim vPasswords As Variant
Dim result As String
Dim i, x As Integer
Dim arrLength As Integer


x = 0



vPasswords = Array("OSLO", "Northern Europe", "FERRARI", "Southern
Europe", "HEINEKEN", "Central Europe")
arrLength = UBound(vPasswords) - 1


For i = 2 To Sheets.Count
Sheets(i).Visible = xlSheetVeryHidden
Next i

result = Application.InputBox(prompt:="Enter password", Type:=2,
Title:="Port Report 2005")

If result = "system" Then
For i = 2 To Sheets.Count
Sheets(i).Visible = xlSheetVisible
Next i
Else

Do
If result = "False" Then Exit Sub

For i = LBound(vPasswords) To UBound(vPasswords) Step 2
If vPasswords(i) = result Then
With Sheets(vPasswords(i + 1))
.Visible = True
.Activate
x = x + 1
End With

End If

If i = arrLength Then Exit Do

Next i

Loop While True
If x = 0 Then
MsgBox "You entered wrong password, please try
again, If you miss your password pls contact Knut Espegren"
'Else
'Sheets(2).Visible = xlSheetVisible
End If
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub


I apprecatie any help with this one as it is driving me crazy!

Thank you in advance

Brgds

Knut