I'm trying to run a macro when the workbook opens. It was working fine, I'm not sure what changed.
Code to run the macro:
Macro, which works when manually started:
and the code for the Combo Box that is populated by the macro:
Everything works except the Run command for the workbook. We have tried replacing the macro and using Call instead of Run.
Additionally, I have put On Error Resume Next into the Combo box code because of an error that was popping up, which didn't seem to affect the overall performance of the worksheet.
Any help would be great, I've asked several of my coworkers, no one is sure why the call doesn't work. Would it be possible to put the run into the combo box code, for instance when the drop down is clicked it populates, but only does it once?
Thanks for any help.
Code to run the macro:
Code:
Private Sub Workbook_Open()
Run "PopulateCB"
End Sub
Code:
Private Sub PopulateCB()
For i = 2 To Sheets.Count
If Sheets(i).Visible = xlSheetVisible Then Sheet5.cbSheets.AddItem Sheets(i).Name
Next i
End Sub
Code:
Private Sub cbSheets_Change()
On Error Resume Next
Worksheets(cbSheets.Value).Select
Charts(cbSheets.Value).Select
Sheet5.cbSheets.Text = ""
Sheet5.cbSheets.Value = ""
End Sub
Additionally, I have put On Error Resume Next into the Combo box code because of an error that was popping up, which didn't seem to affect the overall performance of the worksheet.
Any help would be great, I've asked several of my coworkers, no one is sure why the call doesn't work. Would it be possible to put the run into the combo box code, for instance when the drop down is clicked it populates, but only does it once?
Thanks for any help.
Last edited: