![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
I'm using MS Excel 97. A worksheet has a combo box with vba code associated with it. When the combo box changes, so does data on a chart.
The problem, however, is that the code in the combo box runs when I close the file. Why? (I don't want the code to run. Plus, I don't have any code elsewhere in the file where the OnClose event is used.) I don't understand why this happens when the code is in a private sub within the combo box control. Can anyone explain, and come up with a solution? Thanks, Pete |
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
|
I think you're going to have to give more details. Is it the combobox from the Control Toolbox? Are you adding items through code or is it linked to a range? It would also be helpful if you post both the combobox code and the Before_Close code.
Regards, D |
|
|
|
|
|
#3 | |
|
Guest
Posts: n/a
|
Yes, the combobox is from the Control ToolBox, and the items listed are from a range.
Here's the code for the combobox: (where the selection changes the pagefield of a pivot table) Private Sub cboHARP_Change() Application.ScreenUpdating = False ActiveCell.Activate ActiveSheet.PivotTables("pivotMEMBERSHIP").PivotFields("HARP").CurrentPage = cboHARP.Value If cboHARP.Text <> "ALL GRIPA" Then Range("c14") = cboHARP.Text Else Range("c14") = "GRIPA" End If Range("A1").Activate Application.ScreenUpdating = True End Sub As for code in the BeforeClose event, there is none: Private Sub Workbook_BeforeClose(Cancel As Boolean) End Sub So, give the above info, what is triggering the code in the combobox private sub when closing the file? Thanks, Pete Quote:
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
|
There's nothing that leaps out at me. I'll gladly have a look at the workbook if you want to send it (of course strip out any data you don't want others to see).
dklann@lineone.net Regards, D |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|