Populate ComboBox with list of charts on sheet
I am tired of formatting axes by hand to zoom in on data in scatter plots, so I am building a userform with axes controls. I want it to be easily reusable for many charts in many worksheets, so I am not intending to store the axes ranges on the sheet. Here's my userform : . The text boxes are called YMaxEnter, YminEnter, XminEnter and XMaxEnter. The comboBox at the top (ComboBox1) should have a list of charts on the current sheet. When I select one, the four text boxes should fill in with the appropriate .Axes(xlValue).MinimumScale, etc. Private Sub UserForm_Initialize() Dim thisChart as Chart For Each thisChart In ActiveWorkbook.Charts 'Nothing happens after the ForEach ComboBox1.AddItem (thisChart.ChartTitle.Caption) Next End Sub Private Sub ComboBox1_AfterUpdate() `Some code that gets the Chart object, cht, back from ComboBox1 YMinEnter.Value = cht.Axes(xlValue).MinimumScale YMaxEnter.Value = cht.Axes(xlValue).MaximumScale XMinEnter.Value = cht.Axes(xlCategory).MinimumScale YMaxEnter.Value = cht.Axes(xlCategory).MaximumScale End Sub Then I will have routines like this, but with some error checking added.: Private Sub YMaxEnter_AfterUpdate() 'Again, code to get the chart object, cht, out of ComboBox1. cht.Axes(xlValue).MaximumScale = MaxEnter.Value End Sub My first step isn't working, however - the comboBox initialization loop doesn't do anything. For Each thisChart In ActiveWorkbook.Charts doesn't throw up an error, but it doesn't do fill in any values, and the routine never moves on to the next line (ComboBox1.AddItem (thisChart.ChartTitle.Caption)) I know that I am going to run in to more trouble in the second routine (getting the chart object back from the combobox) but right now I can't even get alist of charts into the combobox. All suggestions welcome.
Hyperlink based on two dynamic cell values
Excel - Determine if value is contain in named range
Writing excel functions in vba
I need to be able to select columns in Excel by specifying column numbers in vba
How to update a specific row of a table in Excel using Microsoft Graph?
columns' values based on specific rows in pivot table excel
VBA Adding cells from one sheet to another by cell
Searchng a sheet for a value and returning row & column numbers
How to take a control of specific cell of XL?
Vlookup exact text on a cell text string
HTTP GET responds with empty body, downloads excel document in IE
VBA replace comma with line break in word?
Excel online sharing
Change cell value based off of selection from ListBox
How to remove hidden quotes
Sorting out data by insert and copy and paste special