I have a table of timed data points for solar power generation. I want to be able to select a data range (ie all data in one month), generate a trendline, and record the the trendline formula in a table.
Sheet7 is a large table of data, with columns "P", and "W" of interest for now.
Sheet13 is where I am trying to record my table of trends for comparison.
To that end I made this macro. It
-makes a table of unique year/month combinations in sheet 13
-loops through each item in the table and generates a range object including the data for that month
-charts the data and extracts the trendline formula
-records the formula in the table in sheet13
The problem is the macro returns blank strings if it is allowed to run like normal. But if I step through in debug mode, the results are recorded as expected.
the problem seems the string assignments in "getTrend()"
I got through my one year of data by hitting F8 between strategically placed code breaks, but this will be a major pain when I need to run multiple years of data. Any advice on fixing this would be greatly appreciated.
Here is my code in entirety
File with some example data is attached. All other columns were cleared to get it under 1000kB limit.
Bookmarks