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

Ed Harris

Board Regular
Joined
Dec 9, 2017
Messages
51
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

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
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,224,585
Messages
6,179,696
Members
452,938
Latest member
babeneker

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