Excel graph drawn by macro doesn't highlight data in the sheet when clicked

Ed Harris

New Member
Joined
Dec 9, 2017
Messages
49
Office Version
  1. 2010
Platform
  1. Windows
Hi, I am making lots of small graphs to help characterise some data so used the Record Macro Function, which works fine, but if I click on the chart line the data is not highlighted in the sheet as it would normally. Any Ideas why not? Here is the macro.

Sub ABC()
'
' ABC Macro
'

'
ActiveCell.Offset(-4, 0).Range("A1:C9").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Range("'July to Sept'!$C$11824:$E$11832")
End Sub
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
I have found the solution. In case anyone else has the same problem, the macro was not recording in "use relative reference mode", despite being set in that mode, so when I click the plot it highlighted a location off screen.
 
Upvote 0

Forum statistics

Threads
1,215,449
Messages
6,124,911
Members
449,195
Latest member
Stevenciu

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