+ Reply to Thread
Results 1 to 8 of 8

Command button auto run

  1. #1
    Registered User
    Join Date
    05-16-2012
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    7

    Command button auto run

    Does any expert can help me to modify this file which is created by my friend before , I want to modify the "Trade" Button to auto run , if range F3:I3 is blank - no action, if range F3:I3 has figure - "Trade" Button will auto run itself. Here is the VBA

    text1.pngtext2.png


    Please Login or Register  to view this content.
    Last edited by Paul; 05-16-2012 at 11:30 AM. Reason: Added CODE tags for new user. Please do so yourself in the future.

  2. #2
    Registered User
    Join Date
    05-04-2012
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Command button auto run

    I have a question or two

    Is your data coming in live?

    Do you want the button to remain for manual operations?

    This can be done if the Range is calculated. You can go into the worksheet private sub calculate and call your CommandButton1 if you set it up as a public sub that was called by the click.

  3. #3
    Registered User
    Join Date
    05-16-2012
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Command button auto run

    Yes, the data coming in live & i want the button to remain for manual operations for necessary but mainly want the "trade" can autorun itself.

    "You can go into the worksheet private sub calculate and call your CommandButton1 if you set it up as a public sub that was called by the click. " ??????

  4. #4
    Registered User
    Join Date
    05-04-2012
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Command button auto run

    ok

    take what you have in "Private Sub CommandButton1_Click()" and create a Public sub

    Please Login or Register  to view this content.
    and make your button like this
    Please Login or Register  to view this content.
    Now under the worksheet in the private sub for calculate

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-04-2012
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Command button auto run

    ooops there should be a call to "trade" in the button code

  6. #6
    Registered User
    Join Date
    05-16-2012
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Command button auto run

    Thx, let me try but the "Trade" still function?

    On the other, if the figure in one of the cell "E1:I3" is the text not number, can this command "Private Sub Worksheet_Calculate()" work?

    And, if i want it to have a "beep" sound when the cell has figure, what can i do?
    Last edited by byron.; 05-16-2012 at 01:13 PM.

  7. #7
    Registered User
    Join Date
    05-04-2012
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Command button auto run

    you might need to make some changes to the spread sheet if you want text in there.

    if you add another column or range that looks at the range you want and decides if it is what you are looking for such as a number. You can have it put a 1 for when you want the "trade" to run and a 0 when you don't.

  8. #8
    Registered User
    Join Date
    05-16-2012
    Location
    HK
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Command button auto run

    IC, but the "Trade" button still function? And the new command do i need to follow your ordering to place it to make work?

    If i want it to have a "beep" sound when the cell has figure, what can i do?
    Last edited by byron.; 05-16-2012 at 01:40 PM.

+ 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