+ Reply to Thread
Results 1 to 5 of 5

How to execute a Command Button (simple)

  1. #1
    Registered User
    Join Date
    08-16-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    19

    How to execute a Command Button (simple)

    Hi - sorry I feel a bit sheepish asking this, but I searched on the web and could not find an answer.

    I have a set of Macro buttons - they work fine (a little hand comes up when I hovr over them and I can click and they execute ok).

    Now I set up a Command button and added some code behind it. However, even after I have exited 'Design Mode' the little hand does not come up when I hover over the button - and when I click it nothing seems to happen.

    I guess I am missing something fundamental here.

    Thanks for any help. (Excel 2003)

    -----Update: I can use Properties to change the Mouse over - but not to a 'Hand'. That is one question.

    The other thing is that nothing seems to happen anyway when I left click the button.
    Is there any simple code to insert just to check if it is doing anything - eg. change the colour of a cell?
    Last edited by cronshd; 08-28-2012 at 11:02 AM. Reason: Updated description

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: How to execute a Command Button (simple)

    hi cronshd, if it's a hand that appears when you hover over the button you are using Forms command button. It works by assigning macro to it.
    Put the following code in VB editor:
    Please Login or Register  to view this content.
    Click the button to select* it, right button mouse click - Assign macro - select Test - OK
    There are two types of selecting this object, the one you need has Assign macro option enabled in right-mouse click menu.

  3. #3
    Registered User
    Join Date
    08-16-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: How to execute a Command Button (simple)

    Thanks - yes the macro buttons work fine.

    This is a Command button, with VB code which I am using for the first time.

    The code is as follows:

    Please Login or Register  to view this content.


    ---------- Post added at 04:15 PM ---------- Previous post was at 04:05 PM ----------

    So just to clarify, my questions are:

    1. How do I get a 'hand' to appear as a MouseOver?

    2. Nothing seems to happen when I click on the button - it certainly does not change the row heights as hoped.

    Many thanks.
    Last edited by Cutter; 08-28-2012 at 01:03 PM. Reason: Added code tags / Removed whole post quote

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How to execute a Command Button (simple)

    @ cronshd

    Welcome to the forum.

    Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.

  5. #5
    Registered User
    Join Date
    08-16-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: How to execute a Command Button (simple)

    Thanks.

    I have solved it now by amending the code. I'm not sure how to add code tags - are these PHP tags?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1