S
Sam
I have a few workbooks that have combo box controls on them which trigger
some VBA when a change is made by the user. Each workbook on it's own works
fine. When I open a 2nd workbook, for some reason the event code in the
Private Sub of the already opened workbook gets triggered. Why would this
happen? Why doe's opening a 2nd workbook trigger changes in the original?
On a related note, when I open a singel workbook, without the user making
any changes the event code executes. I'm guess that during the initial
calculation the linked cell value is getting updated which changes the
control which activates the code.
When I debug I can see that thisworkbook.name <> activeworkbook.name.
Here's an example of the Control code:
Private Sub Selector_Market_Change()
If Not ImBusy Then
ImBusy = True
Application.ScreenUpdating = False
theCell = Selection.Address
Sheets("Params").Range("theBenchmark") =
Sheets("Params").Range("theBenchmarkCalc") 'I get an error here since the
range doesn't exist in the new book.
Call Get_Data1
Range(theCell).Select
ImBusy = False
End If
End Sub
some VBA when a change is made by the user. Each workbook on it's own works
fine. When I open a 2nd workbook, for some reason the event code in the
Private Sub of the already opened workbook gets triggered. Why would this
happen? Why doe's opening a 2nd workbook trigger changes in the original?
On a related note, when I open a singel workbook, without the user making
any changes the event code executes. I'm guess that during the initial
calculation the linked cell value is getting updated which changes the
control which activates the code.
When I debug I can see that thisworkbook.name <> activeworkbook.name.
Here's an example of the Control code:
Private Sub Selector_Market_Change()
If Not ImBusy Then
ImBusy = True
Application.ScreenUpdating = False
theCell = Selection.Address
Sheets("Params").Range("theBenchmark") =
Sheets("Params").Range("theBenchmarkCalc") 'I get an error here since the
range doesn't exist in the new book.
Call Get_Data1
Range(theCell).Select
ImBusy = False
End If
End Sub