Switch Rows/Columns

Qete_ARG

Board Regular
Joined
Oct 20, 2005
Messages
72
First of all, let me tell you that I am re-posting this cause a member of the board cannot see the contents of the post that was posted a few days ago:

In a previous post I didn't know how to explain what was my problem.
I now know that what I needed to do was to switch between rows/columns (I have excel in spanish so I didn't really know which was the english translation).
I did some tests:
I created column clustered chart.
After it was done, I started the macro recorder and switched Columns to Rows. Here I stopped the macro recorder.
After that I recorded while I switched Rows to Columns.
Well..now I have 2 macros in order to toggle between row and columns (I could do it in one macro, but I prefer to leave it like this for now).
The strange thing is that when I execute any of these macros I get an error message!!
How is this possible?? This code is generated by the macro recorder but it is still not working!
I imagine there is some explanation for this behaviour and It would be really, I mean reeeaaaalllyyy nice if anyone of you knew why and would like to share it!
Greetings from Argentina, Miguel.
__________________
 
Hello,

What does your code look like (post that) and what error do you get (in English)?
 
Upvote 0
Code:
'I add a chart
Set myChtObj = ActiveSheet.ChartObjects.Add _
(Left:=250, Width:=375, Top:=75, Height:=225)

With myChtObj.Chart

 .ChartType = xlColumnClustered

 Do Until .SeriesCollection.Count = 0
  .SeriesCollection(1).Delete
 Loop

'Add series based in the user's selection (one serie for each selected item)

For i = 0 To ListBox1.ListCount
 For j = 0 To UBound(arrClientesSeleccionados)

'Here I check if the data in the sheet corresponds to the selected client  

If Sheets("Comparativos").Range("InicioReporte").Offset(0, i).Value = arrClientesSeleccionados(j) Then

'If it corresponds, I add a new serie  
 
   With .SeriesCollection.NewSeries
    .Values = Range(Sheets("Comparativos").Range("InicioReporte").Offset(0, i), Sheets("Comparativos").Range("InicioReporte").Offset(0, i).End(xlDown))
    .XValues = Range(Sheets("Comparativos").Range("InicioFechasDelReporte").Offset(0, 0), Sheets("Comparativos").Range("InicioFechasDelReporte").Offset(0, 0).End(xlDown).End(xlDown))
    .Name = Sheets("Comparativos").Range("InicioReporte").Offset(0, i).Value
   End With
    
  End If
 Next j
Next i
End With

'I select the chart
ActiveSheet.ChartObjects(1).Select

'And here is where I get an error:
ActiveChart.PlotBy = xlRows

The error says this:
"The specified dimension is not valid for the actual chart type" (Hope I translated it as the english version shows this error)
Thanks s for your time NateO!
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top