How to explain what columns must be used in a chart?

marlonsaveri

Board Regular
Joined
Jan 28, 2011
Messages
68
The excel creates a table and a chart using macros. Only a two columns chart (Name and Value). However, if there is numbers in Name columns, then instead of it create just one series (names on X axis and values on vertical bars), it created two bars (one to each column) and puts any natural number (1,2,3...) on x axis.

1. I tried to format the first column as "text", but it not resolved.
2. I recorded a macro like this:

Code:
Columns("E:E").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source: = Range ("'Sheet1'! $ E: $ E")
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SeriesCollection (1). XValues ​​= "= 'Sheet1'! $ D: $ D"

However, it doesn't asoociate values with names if we have a empty row or a title. Exemple:

abc 1
def 123
312 124
Ax1 4

returns a chart when ABC is the title; "1" is associated to "def", (...) and 4 is associated to nothing.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
It helps:

with activechart
.SetSourceData Source:=sheets(1).Range("B1", Range("B1").End(xlDown).Address)
.SeriesCollection(1).XValues = sheets(1).Range("A2", Range("A2").End(xlDown).Address)
 
Upvote 0

Forum statistics

Threads
1,224,578
Messages
6,179,654
Members
452,934
Latest member
mm1t1

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