Worksheet_BefordDoubleClick

liampog

Active Member
Joined
Aug 3, 2010
Messages
305
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi

I have a double click event that shows a Userform and I also have a button that does the same thing.

I want a piece of code when the Userform initialises that checks to see if the button or the double-click was used (to do different things).

I tried using If Application.Caller = "Button_Name" but when using double-click, this results in an error obviously.

Can anyone help me out?

Thanks in advance
 

Some videos you may like

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,056
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
I would add a property/public variable to the form and assign it a value that allows you to tell which routine called it. Then use a public procedure (or the Activate event) instead of the Initialize event. If you're feeling lazy, just use a public variable. ;)
 

Watch MrExcel Video

Forum statistics

Threads
1,122,224
Messages
5,594,915
Members
413,952
Latest member
JGer

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
Top