How to use an event macro in all the workbooks that the user opens?

arunkmr88

New Member
Joined
May 18, 2015
Messages
5
Hi all,

I've been trying to develop an event macro[dbl_click event] to be used in all workbooks that the user opens once they toggle a button to on. And it should stop if they select off.[preferred radio buttons] .

After, an extensive search, I found that it can be made possible with the help of class modules.

Kindly guide me as im stuck and not able to move on and also suggest me if I'm on the right path.

The following code comes under class module
Code:
Private WithEvents App As Application


Private Sub App_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim strRange As String
strRange = Target.Cells.Address & "," & _
Target.Cells.EntireColumn.Address & "," & _
Target.Cells.EntireRow.Address
Range(strRange).Select
End Sub


Private Sub Class_Initialize()
    Set App = Application
End Sub

How should i use this to enable/disable as per user requirement of the user.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
You need to put that code into a class module in an add-in, then use an event of your optionbuttons to create a new instance of the class, or destroy it as applicable for switching it on and off.
 
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,346
Members
452,638
Latest member
Oluwabukunmi

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