Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Command Button (Office 97 SR2)

    Hi

    I am trying to add a command button to goto a defined name cell on the sheet , but I have no idea how to do this.
    I created a macro and used a hyperlink but it does not look so proffesional as a command button.

    any help gratefully received

    Braddy
    If you are a fool at forty, you will always be a fool

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Command Button (Office 97 SR2)

    Put on the command button and either add the macro code you created to the command button's link event or just have the link event call the macro.

    Steve

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Command Button (Office 97 SR2)

    There are two different types of command buttons you can add to a workbook: one from the "Forms" toolbar and one from the "Control Toolbox" toolbar.

    If you add a command button from the Forms toolbar, you'll be asked immediately to specify a macro to be run. Accept the proposed name (or change it if you don't like it) and click New. You'll be taken to the Visual Basic Editor, with the Sub ... End Sub for the OnClick procedure already created for you in a standard module. Type an instruction like the following in the empty line between Sub... and End Sub:

    ActiveWorkbook.Worksheets("MySheet").Range("Braddy ").Select

    or

    ActiveSheet.Range("Braddy").Select

    Of course, you must substitute the appropriate names. Switch back to Excel. Click outside the command button, then click it to test its action. To edit the command button's properties, right click it; you'll see selection handles at the corners.

    If you add a command button from the Control Toolbox, design mode will be switched on. Right click the button and select View Code. You'll be taken to the Visual Basic Editor; the code will be in the class module for the worksheet the button is on. Type the same instruction as for the other type. Switch back to Excel. To test the button, switch off design mode by clicking the first button on the Control Toolbox; to edit, switch design mode on again.

  4. #4
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Command Button (Office 97 SR2)

    Hi

    Thank you for your reply being a novice I'm not sure I understand your reply However Hans supplied me with a with a reply that my simple brain can understand using the form command button

    Thanks again
    If you are a fool at forty, you will always be a fool

  5. #5
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Command Button (Office 97 SR2)

    Hi Hans

    Thanks for your reply ,the form command button was the answer for my limited knowledge and worked just fine.

    Thanks very much
    If you are a fool at forty, you will always be a fool

Posting Permissions

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