I have a problem. Let's say, for simplicity, I'm processing a simple two colunms of data repeatedly and the output is a plot, so I recorded a macro. But the problem is I want to set the axis labels on the chart, as I want, so as they have (the same) concrete names, every times I run the macro. But the vba- macro code does not record any information about the difference between the X and the Y axis, and the result is, that the one axis label is overwritten or, there are two same axis labels in the macro- generated chart. I add: code sample (in the code, I removed all unnecessary data, and such, that prevent the macro from running next time). What I want (I apologize for such rude formulation, but I just wanted to strictly state, what is my idea): I would like to have a solution, such, that every time I run the macro, I have a different chart, but with the same axis label names, i.e., X-axis: U [V], and Y-axis: I [A]
code:
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatterSmooth
ActiveChart.ApplyLayout (1)
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "=""I-V char"""
ActiveChart.SeriesCollection(1).XValues = "=hviezd1!$D$2:$D$193"
ActiveChart.SeriesCollection(1).Values = "=hviezd1!$E$2:$E$193"
ActiveChart.Axes(xlValue).AxisTitle.Select
ActiveChart.Axes(xlValue, xlPrimary).AxisTitle.Text = "I [A]"
ActiveChart.Axes(xlValue).AxisTitle.Select
ActiveChart.Axes(xlValue, xlPrimary).AxisTitle.Text = "U [V]"
I tried to record the macro by different ways such as throught the tool bar in excel (also more ways throught this), throught the keyboard, but none recorded code contains any information, that could distinguish between X and Y axis.
I'm using a 2007 excel (as I read before in other questions, the 2007 excel chart macro recorder is pretty poor and the problem, I'm talking about might be caused by this), but I'm looking for any good answer that can help solve my problem. Thank's for your answer.