MACRO to build a graph - y axis not shown

valentina_putrino

New Member
Joined
Jun 4, 2019
Messages
6
Hi all
I managed to create a macro to build a graph which updates each time the lenght of the columns change.
When I try to put the name of the horizontal axis, it work. When I try to do the same with the vertical axis it doesn't.
Anyone willing to help?
I am very grateful

Thanks a lot
valentina
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Dear Lavina - yes thanks

Sub graphJ()
'
' graphJ Macro
'
Dim i As Integer
i = Cells(53, 55).Value
Range(Cells(3, 52), Cells(i, 53)).Select
ActiveSheet.Shapes.AddChart2(240, xlXYScatterSmoothNoMarkers).Select
ActiveChart.SetSourceData Source:=Range(Cells(3, 52), Cells(i, 53))
ActiveChart.SeriesCollection.NewSeries
ActiveChart.FullSeriesCollection(1).Name = "=""FLOD"""
ActiveChart.FullSeriesCollection(2).Name = "=""MIN"""
ActiveChart.FullSeriesCollection(2).XValues = Cells(3, 56)
ActiveChart.FullSeriesCollection(2).Values = Cells(3, 55)
ActiveChart.ChartTitle.Text = "Flood Mechanism"
ActiveChart.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
Selection.Format.TextFrame2.TextRange.Characters.Text = "AA"
ActiveChart.SetElement (msoElementPrimaryValueAxisTitleAdjacentToAxis)
ActiveChart.SetElement (msoElementLegendBottom)
ActiveChart.FullSeriesCollection(2).Points(1).Select
With Selection
.MarkerStyle = -4142
.MarkerSize = 5
End With
Selection.MarkerStyle = 2
Range("BG5").Select
'
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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