VBA to simulate double-clicking a cell

kgartin

Board Regular
Joined
May 6, 2010
Messages
201
I know it sounds weird...but I have some complicated code that has MANY conditions for when I double click a cell in a range. I want a code that will run the code associated with the double-clicking of the cells automatically without actually double clicking.

to sum up (I think):
I have an automated system where a multi-sheet workbook (invoice) gathers data from another spreadsheet and when finished, activates another sheet in the workbook that includes the itemized list of charges and the total cost.

I have a forecast spreadsheet that gathers the total cost from the invoice spreadsheet when a cell is double-clicked in the forecast spreadsheet (among other things). I want to automate the process so that when the INVOICE gathers the data it needs and activates the ITEMIZED SHEET, the TOTAL listed on THAT sheet is AUTOMATICALLY transferred to the proper area of the FORECAST sheet without any double-clicking.

I basically don't want to have to rewrite all of the code to do that so if there was a code that would SIMULATE a double-click, it would make things much easier.


Long shot I know...:)
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
You could make the Worksheet_BeforeDoubleClick event routine Public and then you can call the double-click event from anywhere in your project as follows:
Code:
Call Sheet1.Worksheet_BeforeDoubleClick(ActiveWindow.RangeSelection, False)
Change Sheet1 to suit.

EDIT:

Alternatively, you could have the code located in a standard module and call the code from the Double-click event as well as from anywhere in the vbaproject.
 
Last edited:
Upvote 0
You could make the Worksheet_BeforeDoubleClick event routine Public and then you can call the double-click event from anywhere in your project as follows:
Code:
Call Sheet1.Worksheet_BeforeDoubleClick(ActiveWindow.RangeSelection, False)
Change Sheet1 to suit.

EDIT:

Alternatively, you could have the code located in a standard module and call the code from the Double-click event as well as from anywhere in the vbaproject.


I get "Object doesn't support..." Blah Blah...


Any other ideas?
 
Upvote 0
I get "Object doesn't support..." Blah Blah...


Any other ideas?

OK I figured it out. I couldn't get yours to work so I just transferred the code into a personal module and CALL it from there. Didn't work at first because I had the code and the module set with the same name. Thanks!
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,920
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top