LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Compile Error

The following macro is triggering a "Block If Without End If" compile error
when invoked, but the necessary End If seems to be there.

Thanks for any assistance.

Sub ToggleNotes()
' Toggles visibility of Notes worksheet; inserts if not yet inserted
' If on the master Macros sheet, toggles visibility of the MenuSheet
' Ctrl-n

Dim intSheet As Integer
On Error GoTo ErrHandler

If ActiveWorkbook.Name = "Macros.xls" Then
With Sheets("MenuSheet")
.Visible = Not Sheets("MenuSheet").Visible
.Activate
End With
Else

' If Notes sheet doesn't exist, add, else toggle visibility and
activate
If Not SheetExists("Notes") Then
Sheets.Add
Type:="\\Diamond\Departments\Cost_Estimating\Templ ates\Notes.xlt"
ActiveWorkbook.Sheets("Notes").Move _
After:=ActiveWorkbook.Sheets(ActiveWorkbook.Sheets .Count)

Else

Application.ScreenUpdating = False
With Sheets("Notes")
.Visible = Not Sheets("Notes").Visible
.Activate
End With

End If

If Sheets("Notes").Visible = False Then

'If multi-page, select page to return to, otherwise return to
Sheet1
If ActiveWorkbook.Sheets.Count 2 Then
intSheet = InputBox("Enter sheet number to return to:",
"Sheet Number", 2)
Sheets(intSheet).Activate
Else
Sheets(1).Activate
End If

Application.ScreenUpdating = True

End If

ErrExit:
Exit Sub

ErrHandler:
MsgBox "There has been the following error. Please contact the macro
administrator." & _
vbCrLf & vbCrLf & Err.Number & vbCrLf & " " & Err.Description
Resume ErrExit

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with this error-Compile error: cant find project or library JackR Excel Discussion (Misc queries) 2 June 10th 06 09:09 PM
VBAProject name compile error, not defined at compile time Matthew Dodds Excel Programming 1 December 13th 05 07:17 PM
error message: compile error, argument not optional Pierre via OfficeKB.com Excel Programming 3 September 5th 05 03:45 PM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM


All times are GMT +1. The time now is 08:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"