VBA to simulate double-clicking a cell

kgartin

Board Regular
Joined
May 6, 2010
Messages
207
Office Version
  1. 365
Platform
  1. Windows
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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,223,711
Messages
6,174,020
Members
452,542
Latest member
Bricklin

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