View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Tia[_3_] Tia[_3_] is offline
external usenet poster
 
Posts: 79
Default VBE Error (Project unviewable)

Hey guys

I have been using the following formula in VBE and it was working just
fine now i want to add more data in th emain sheet so i tried to open
the view code to edit the range but i hav ereceived the following
message :
Project is unviewable
System error & H8000 400 S (-2147467259) unspecified error
so i cannot edited the range what can i do to resolve this problem
Workbook code
Private Sub Workbook_Open()
Dim ws As Worksheet
Sheets("Main").Select
If Range("D1").Value = "Carla" Then
For Each ws In ThisWorkbook.Worksheets
ws.Visible = True
Next ws
End If
End Sub


Sheet Main

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim ws As Worksheet
Dim RngOfNames As Range
If Target.Count 1 Then Exit Sub
If Range("D1").Value = "Carla" Then Exit Sub
Set RngOfNames = Union(Range("A12:A46"), Range("F12:F46"))
Application.ScreenUpdating = False
If Not Intersect(Target, RngOfNames) Is Nothing Then
For Each ws In ThisWorkbook.Worksheets
If ws.Name < "Main" Then ws.Visible = False
Next ws
On Error GoTo NoSht
Sheets(CStr(Target.Value)).Visible = True
Sheets(CStr(Target.Value)).Select
End If
Application.ScreenUpdating = True
Exit Sub
NoSht:
On Error GoTo 0
MsgBox "There is no sheet named " & Target.Value & ".", 16,
"Invalid Sheet Name"
End Sub