MrExcel Publishing
Your One Stop for Excel Tips & Solutions

What "Compile Error" have I made?


Posted by Dwight on July 23, 2001 12:09 PM

Tried to extend use of a macro (which had worked fine) to run on open of the worksheet by copying the macro code into the "This Workbook" object in Project Explorer and creating first line "Private Sub Workbook_Open()", but whenever I open the workbook I get an eror message: "compile error: Only comments may appear after end sub....". The line "Private Sub Workbook_Open()is highlighted yellow, and it there are two "End Sub" statements where I thought I entered one.

What am I doing wrong?

Don't guess the whole macro is relevant:


Posted by Jim on July 23, 2001 12:39 PM

Dwight, If i understand this correctly, remove 1
of the "End Sub" and it should work
HTH
Jim