Hi
I have a macro that works fine if it is in the workbook that is being used, but i want to be able to make it work in any active workbook by assigning the macro to the quick access toolbar, but i cant get a worksheet selection change event in a module in my personal xlsb.
This is my code i am running in the individual workbooks code, but how do i make this work in any sheet under my personal xlsb?
Can you create a selection change macro in all workbooks? once the code has been activated/run from the toolbar with the macro associated to the button
Thanks
Dan
I have a macro that works fine if it is in the workbook that is being used, but i want to be able to make it work in any active workbook by assigning the macro to the quick access toolbar, but i cant get a worksheet selection change event in a module in my personal xlsb.
This is my code i am running in the individual workbooks code, but how do i make this work in any sheet under my personal xlsb?
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
Cells.Interior.ColorIndex = 0
Static xRow
Static xColumn
If xColumn <> "" Then
With Columns(xColumn).Interior
.ColorIndex = xlNone
End With
With Rows(xRow).Interior
.ColorIndex = xlNone
End With
End If
pRow = Selection.Row
pColumn = Selection.Column
xRow = pRow
xColumn = pColumn
With Columns(pColumn).Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
With Rows(pRow).Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End Sub
Can you create a selection change macro in all workbooks? once the code has been activated/run from the toolbar with the macro associated to the button
Thanks
Dan