Bar-chart intervals

K

kima

have a large amount of measurements, about 3000.
they have a value between -10 and 10.

I would like to make a bar-chart. which shows how many measurement
there are between.

-10..-9
-9..-8

etc.

where the y axis are the number of values per interval...and the x axi
are the intervals.

-10 -9 -8 -7 -6 -5 etc.

would like to make it as a macro. The values are in column G



Ki
 
S

Spencer101

kima;1607227 said:
have a large amount of measurements, about 3000.
they have a value between -10 and 10.

I would like to make a bar-chart. which shows how many measurement
there are between.

-10..-9
-9..-8

etc.

where the y axis are the number of values per interval...and the x axi
are the intervals.

-10 -9 -8 -7 -6 -5 etc.

would like to make it as a macro. The values are in column G



Kim

What do you mean by "I would like to make it as a macro"
 
K

kima

I would like it to make the bar chart with a "one-click" macro.
Like the one I have for my line chart:


Code
-------------------

Sub OpretGraf()

'Opretter og formatere graf

With ActiveSheet.ChartObjects.Add _
(Left:=10, Width:=800, Top:=10, Height:=400)
.Chart.SetSourceData Source:=Sheets(1).Range("A:A,G:G")
.Chart.ChartType = xlLine

'Y-akse max og min

.Chart.Axes(xlValue).MaximumScale = 40
.Chart.Axes(xlValue).MinimumScale = -40
.Chart.Axes(xlValue).MajorUnit = 5

'Text på X- og Y-akse

.Chart.Axes(xlCategory).TickLabelPosition = xlLow
'.Chart.Axes(xlCategory).TickLabels.Offset = 1000
.Chart.Axes(xlCategory).TickLabels.Font.Size = 10
.Chart.Axes(xlCategory, xlPrimary).HasTitle = True
.Chart.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Log tidspunkt"


.Chart.Axes(xlValue, xlPrimary).HasTitle = True
.Chart.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Spænding"

'Font størrelse og tal format

.Chart.Axes(xlValue).TickLabels.NumberFormat = "0"
.Chart.Axes(xlValue).TickLabels.Font.Size = 12

'Data linje tykkelse

.Chart.SeriesCollection(1).format.Line.Weight = 1

'Fjerner data label

.Chart.HasLegend = False

'Indsætter overskrift med logging interval. Start tid+dato - slut tid+dato

.Chart.HasTitle = True
.Chart.ChartTitle.Text = IIf([a2].Text <> "", [a2].Text, [a2].End(xlDown).Text) & _
" - " & Cells(Rows.Count, "A").End(xlUp).Text


End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top