Copying and pasting logarithmic trend line from chart into cell

Lguan

New Member
Joined
Mar 2, 2018
Messages
1
Hello good people,

I'm trying to copy and paste a log trend line from a chart into a cell. A sample equation is as follows: y = 0.0083ln(x) - 0.0902. As I run the regression for different datapoints, the equation constantly changes. Hence, I'd like the macro to copy and paste the equation into a cell. The following code does not work when the equation changes (i.e., it does the very first time, but after that, I get an error). The code is as follows:


ActiveChart.FullSeriesCollection(1).Trendlines(1).DataLabel.Select
Selection.Copy
Range("C35").Select
ActiveSheet.Paste

Excel shows that the error is on "ActiveSheet.Paste". I would really appreciate some guidance on how to resolve the issue.

Thanks!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

lrobbo314

Well-known Member
Joined
Jul 14, 2008
Messages
3,150
Office Version
  1. 365
Platform
  1. Windows
Does this work?

Code:
Range("C35").value = ActiveChart.FullSeriesCollection(1).Trendlines(1).DataLabel.Value
 

Watch MrExcel Video

Forum statistics

Threads
1,129,991
Messages
5,639,415
Members
417,088
Latest member
jonstr101

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
Top