Consulting

Results 1 to 2 of 2

Thread: button link worksheet prob

  1. #1
    VBAX Regular
    Joined
    Oct 2005
    Posts
    49
    Location

    button link worksheet prob

    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

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    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....
    [VBA] Sub ButtonEmp()
    Sheets("Emp").Select
    End Sub[/VBA]

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

    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.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •