+ Reply to Thread
Results 1 to 11 of 11

Double-click on cell to run macro

  1. #1
    Registered User
    Join Date
    03-29-2010
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    37

    Double-click on cell to run macro

    I am using an addin that requires double-clicking on a cell containing a function in order to run that function that retrieves data. The data is then presented in a table adjacent to the double-clicked cell. Each time the cell with the function is double-clicked, the data updates.

    I would like to instead create a macro, so I can combine the action of double-clicking with some other code and assign this new macro to run from a button or key combo instead of manually having to double-click with my mouse/touchpad.

    I have tried searching for a solution, and have come across and tried the following Application.DoubleClick method, but this does not seem to work for me:

    Please Login or Register  to view this content.
    For some reason, all it does is select a couple of other cells but doesn't run the function that updates the data.

    I am only new to VBA programming, so any help is greatly appreciated.

    TIA.
    Last edited by cad1llac; 06-30-2010 at 04:59 AM. Reason: code tags pm warning

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Double-click on cell to run macro

    You need to move the code from the double click event. You can't really use a sheet event in an addin's code
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    03-29-2010
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Double-click on cell to run macro

    Thanks for your feedback, and for the help with the code tags.

    I'm not sure what you mean by "move the code from the double click event". Can you elaborate?

    Just to clarify, the addin is not mine. I can't access the addin code and am not trying to modify it. The addin is from the provider of some sharemarket software. The addin includes the function in the cell that I double-click to update a table of data. I'm not so concerned about the addin or the function in the cell.

    I'm interested in understanding how I can code in VBA a double-click on the cell that contains the function so I can do this via a macro instead of having to do it manually.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Double-click on cell to run macro

    I don't think that you can call the double-click event as you are tryingto. Does the addin require the double click event?

  5. #5
    Registered User
    Join Date
    03-29-2010
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Double-click on cell to run macro

    Yes. AFAIK, the only way to run the function in the cell is to double-click on it with a mouse/touchpad.

  6. #6
    Registered User
    Join Date
    03-29-2010
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Double-click on cell to run macro

    I think (hope) I'm starting to understand.

    Is it correct that when I double-click on the cell containing the function, this triggers a double-click event for that function that is also coded in the addin?

    And are you basically saying that because the double-click event is coded in the addin, it is not possible to let the addin know the double-click has occurred (ie trigger the double-click event for the function) by using code in the worksheet?

  7. #7
    Registered User
    Join Date
    02-13-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    70

    Re: Double-click on cell to run macro

    another solution is that you can have a count in an variable, like one click +1 and another click +2.
    then initiate the sub or whatever you want to do..
    cheers

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Double-click on cell to run macro

    I can't see how the double click is coded in the addin. Any double click event in the addin would apply to the addin's sheet that contains it. It can't run because the addin's sheets are hidden.

    Which addin is it & is there an instruction site for it?

  9. #9
    Registered User
    Join Date
    03-29-2010
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Double-click on cell to run macro

    The addin is offered by Iress, an Australian provider of sharemarket software. Iress offers a desktop product used by most Australian stockbrokers, and many Australian online brokers offer a product called WebIress. WebIress includes an optional excel addin called WebIress Market Data Addin for Excel.

    The addin creates a menu and provides access to a number of functions relating to sharemarket data including depth, trades, company options, historical prices, etc.

    The function in the cell is:

    Please Login or Register  to view this content.
    where code is a name I have defined that represents a company's stock code.

    When the cell containing the function is double-clicked, this particular function performs a web query and retrieves/displays data for a number of defined fields.

    As I mentioned, the only way I currently know how to run the function and update the data is to double-click the cell with a mouse/touchpad.

    As an example of what I am trying to do using VBA, I was hoping to find a way to perform the double-click and combine this with creating/updating a PivotTable that summaries the data retrieved.

    Since starting this thread I have sent a query to Iress about this issue. I will post the details of any relevant reply I receive.

    Thanks for your continued interest/efforts on this thread.

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Double-click on cell to run macro

    A Function in an addin should run the same way as a native Excel Function. You shouldn't need to double click

  11. #11
    Registered User
    Join Date
    03-29-2010
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Double-click on cell to run macro

    I sent a query to the addin provider about this issue.

    They have confirmed that what I am trying to achieve is not possible as the data objects are not available for the addin I am using (ie WebIress, the web-based version of the software).

    This is, however, possible using the desktop version of the software. They use a separate Execute function that, on double-clicking a cell, executes the function in the cell. This function resides in a separate type library.

+ 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