Graph with VBA in Excel



Graph with VBA in Excel. Create an automatic function to graph your data.
Check out my online courses www.easyexcelanswers.com/courses.html
All my courses include online support and a user manual
Let me teach you the VBA that I have learn in my five years of consulting

Let’s take the frustration out of user forms

Become an Affiliate and earn 25% on Course Sales

For more help visit my website www.easyexcelanswers.com or email me at easyexcelanswers@gmail.com.

Contact me regarding customizing this template for your needs.

Click for online Excel Consulting

I am able to provide online help on your computer at a reasonable rate.

I use a Blue condenser Microphone to record my videos, here is the link

Check out Crowdcast for creating your webinars

If you need to buy Office 2019 follow

I use Tube Buddy to help promote my videos
Check them out

Follow me on Facebook

TWEET THIS VIDEO

Follow me on twitter
easyexcelanswers

IG @barbhendersonconsulting

You can help and generate a translation to you own language

code
Sub chartwithvalues()
Dim chtChart As Chart
Dim ws As Worksheet
Set ws = Worksheets(“Sheet1”)
‘Create a new chart.

Set chtChart = ws.Shapes.AddChart2(Width:=300, Height:=250, Left:=Range(“A9”).Left, Top:=Range(“A9”).Top).Chart
With chtChart

.ChartType = xlColumnClustered
‘Link to the source data range.
.SetSourceData Source:=Sheets(“Sheet3”).Range(“C1:D10”), _
PlotBy:=xlRows
.HasTitle = True
.ChartTitle.Text = “Faults by Unit”

.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = “Number of Faults”
End With

Call distancevalues
End Sub
Sub distancevalues()
Dim chtChart As Chart
Dim ws As Worksheet
Set ws = Worksheets(“Sheet1”)
Dim RNG1 As Range, RNG2 As Range, RNG3 As Range
Set RNG1 = Sheets(“Sheet4”).Range(“B1:B11”)
Set RNG2 = Sheets(“Sheet4”).Range(“D1:D11”)

Set chtChart = ws.Shapes.AddChart2(Width:=300, Height:=250, Left:=Range(“K9”).Left, Top:=Range(“K9”).Top).Chart
With chtChart

.ChartType = xlColumnClustered
‘Link to the source data range.
.SetSourceData Source:=Union(RNG1, RNG2), _
PlotBy:=xlRows
.HasTitle = True
.ChartTitle.Text = “Top Distance Traveled”

.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = “Kilometers”
End With

Call makeadoughnut
End Sub
Sub makeadoughnut()
Dim srs1 As Series
Dim chtChart As Chart
Dim ws As Worksheet
Set ws = Worksheets(“Sheet1”)
‘Sheet1.Select
Set chtChart = ws.Shapes.AddChart2(Width:=300, Height:=250, Left:=Range(“A26”).Left, Top:=Range(“A26”).Top).Chart
With chtChart
.ChartType = (xlPie)
‘ActiveSheet.Shapes.AddChart2(251, xlDoughnut).Select
.SetSourceData Source:=Range(“Sheet4!$D$11:$I$12”)
.HasTitle = True
.ChartTitle.Text = “Faults by Type”

End With

End Sub

*this description may contain affiliate links. When you click them, I may receive a small commission at no extra cost to you. I only recommend products and services that I’ve used or have experience with.

Watch more new videos about Excel Office | Synthesized by Mindovermetal English

Rate this post

Bài viết liên quan

Theo dõi
Thông báo của
guest
0 Comments
Phản hồi nội tuyến
Xem tất cả bình luận