Hey,
I have the following code that runs inside a workbook category of workbook A
and the following code that runs inside a module of the same workbook, workbook A.
Now if I open a new workbook, workbook B, and type in letter b and the code from workbook A will run in the newly opened workbook B.
If I close workbook A and then type b on workbook B. workbook A will open up by itself and run the code on the workbook B.
How do I stop this behaviour and run the code in only that workbook where the code resides? meaning in workbook A.
will appreciate help on this.
ty
I have the following code that runs inside a workbook category of workbook A
Code:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Application.OnKey "{b}", "search_b"
End Sub
and the following code that runs inside a module of the same workbook, workbook A.
Code:
Sub search_b()
Dim Fnd As Range
Set Fnd = Range("H:H").Find("b*", , xlValues, xlWhole, , , False, False)
If Not Fnd Is Nothing Then
Application.Goto Cells(Fnd.Row, ActiveCell.Column), scroll:=True
End If
End Sub
Now if I open a new workbook, workbook B, and type in letter b and the code from workbook A will run in the newly opened workbook B.
If I close workbook A and then type b on workbook B. workbook A will open up by itself and run the code on the workbook B.
How do I stop this behaviour and run the code in only that workbook where the code resides? meaning in workbook A.
will appreciate help on this.
ty
Last edited: