Hello, I am trying to make a US Map that is colored blue and then has certain states colored orange. (In my example all of the states with the number "1" in column "B" next to it should be orange.)
I was able to fumble my way through it using the recording tool but I keep getting errors when I use it on other computers.
I have attached a workbook as an example. The lines that I am getting an error on are below:
Here is my code:
I would also like to widen the state lines if possible. And instead of using active sheet I need it to run sheet named "Sheet1".
Is anyone able to help me with this?
Thanks
Cross Posted:
https://www.excelforum.com/excel-programming-vba-macros/1368879-macro-which-creates-us-map-with-colored-in-states.html
I was able to fumble my way through it using the recording tool but I keep getting errors when I use it on other computers.
I have attached a workbook as an example. The lines that I am getting an error on are below:
VBA Code:
.SeriesColorMinGradientStop.StopColor.RGB = 49407 'color
.SeriesColorMinGradientStop.StopColor.TintAndShade = 0
.SeriesColorMinGradientStop.StopColor.Transparency = 0
Here is my code:
VBA Code:
Sub Mapmacro()
Range("L13:M63").Select
ActiveSheet.Shapes.AddChart2(494, xlRegionMap).Select
ActiveChart.FullSeriesCollection(1).Select
With ActiveChart.FullSeriesCollection(1)
.SeriesColorMinGradientStop.StopColor.RGB = 49407 'color
.SeriesColorMinGradientStop.StopColor.TintAndShade = 0
.SeriesColorMinGradientStop.StopColor.Transparency = 0
End With
With ActiveChart.FullSeriesCollection(1)
.SeriesColorMaxGradientStop.StopColor.RGB = 49407 'color
.SeriesColorMaxGradientStop.StopColor.TintAndShade = 0
.SeriesColorMaxGradientStop.StopColor.Transparency = 0
End With
ActiveChart.FullSeriesCollection(1).Points(40).Select
ActiveChart.FullSeriesCollection(1).Points(33).Select
ActiveChart.PlotArea.Select
ActiveChart.FullSeriesCollection(1).Select
ActiveChart.Legend.Select
ActiveChart.SetElement (msoElementLegendNone)
With ActiveChart.Parent 'This with statement tells the macro where to move the graph to on the page.
.Top = Range("G4").Top
.Left = Range("G4").Left
End With
End Sub
I would also like to widen the state lines if possible. And instead of using active sheet I need it to run sheet named "Sheet1".
Is anyone able to help me with this?
Thanks
Cross Posted:
https://www.excelforum.com/excel-programming-vba-macros/1368879-macro-which-creates-us-map-with-colored-in-states.html