Hi,
I have a particular VBA code that I want to have available in any sheet that I use in Excel. I want to somehow become available anytime I open an excel file (new or existing), sort of like the macros stored in personal.xls, that are available for action in any excel file I open. I tried pasting the code in the "view code" area of the sheet1, and "this workbook" under the VBA Project (personal.xlsb)/microsoft excel objects heading, hoping it will behave just like the macros stored in the module section would, but it doesn't. Am I doing something wrong, or is this the wrong way to approach the problem. I am attaching below the code that I want to insert in the sheet to have available in any file and the code for the two macros that I want to use to turn this code on or off, depending on when I want to use it.
VBA code for sheet:
Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
Select Case Highlight
Case True
Union(Target.EntireRow, Target.EntireColumn).Select
Intersect(Target.EntireRow, Target.EntireColumn).Activate
End Select
Application.EnableEvents = True
End Sub
Code for macros used to turn this sheet code on and off:
Option Explicit
Public Highlight As Boolean
Sub HighlighterOn()
Highlight = True
End Sub
Sub HighlighterOff()
Highlight = False
End Sub
Thanks for the help.