ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Bar-chart intervals (https://www.excelbanter.com/excel-programming/447607-bar-chart-intervals.html)

kima

Bar-chart intervals
 
1 Attachment(s)
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 measurements there are between.

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

etc.

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

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

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


I have attached a file with the examples of values...column A is not formattet only text.

Kim

Spencer101

Quote:

Originally Posted by kima (Post 1607227)
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 measurements there are between.

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

etc.

where the y axis are the number of values per interval...and the x axis 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"?

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

Kim


All times are GMT +1. The time now is 08:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com