PDA

View Full Version : button link worksheet prob



DarReNz
11-17-2005, 09:07 PM
Hi,

I have 2 buttons one on each sheet and link them, however when i click the button i get the error msg "Only comments may appear after End Sub, End Function, End Property.

Sub ButtonEmp()
Sheets("Emp").Select
End Sub


This always appear everytime i try to run the macro
------------------------------------------------------------------
ActiveWorkbook.Save
Application.Run "filename.xls'!MainMenuEmp"

When i try to delete them and run the macro again the same thing happens. Please help

lucas
11-18-2005, 08:37 AM
Hi DarReNz,
Sounds like you have some code or text outside of the subroutine open and close statements....

Everything should be between sub and end sub like this....
Sub ButtonEmp()
Sheets("Emp").Select
End Sub

If you have text that is not between sub and end sub....try putting an apostrophe in front of it like this...
Sub ButtonEmp()
Sheets("Emp").Select
End Sub
'any other text


If this doesn't clear it up for you, maybe you could post your code here or attach your workbook so others could take a look at it....be sure to remove any private info from the workbook before you post it here.