Run Macro is there is activity with the excel workbook

mrMadCat

New Member
Joined
Jun 8, 2016
Messages
39
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
Hello.
I need to run a macro that reacts on activity showing that user works with the workbook: selecting cells, refreshing pivots, changing formats, copy-pasting etc. I didn't find any universal function (if there is any please say). But I've found this to be quite suitable for me because most of activity with excel is based on selecting cells.
Code:
Sub Worksheet_SelectionChange(ByVal Target As Range)
msgBox "Change"
End Sub
The problem is that I have to put this macro in some Worksheet but I want to make it work independently for any active worksheet in the workbook. What I need to solve this?

Sorry for may be dumb question, I am quite a casual VBA user.
Thank you.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Finally found a solution: :)
Code:
Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
msgBox "Change"
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,905
Messages
6,175,297
Members
452,633
Latest member
DougMo

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