Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Calculate event using chart data

I am trying to pull the trendline equations from a graph into my spreadsheet.
I then modify the text so that they point to cells and call a solver
routine. I would like this macro to run every time the sheet is
recalculated. However, the workbook seems to recalculate every time the
chart or the sheet is activated. This causes an infinite loop.

My code is as follows:

Sub update()

Range("a1").Select
Application.DisplayAlerts = False
Application.ScreenUpdating = False

ActiveSheet.ChartObjects("Chart 5").Activate

eq1 = ActiveChart.SeriesCollection(2).Trendlines(1).Data Label.Text
eq2 = ActiveChart.SeriesCollection(1).Trendlines(1).Data Label.Text

Range("c57").Value = eq1
Range("c58").Value = eq2
Range("d57").Value = eq1
Range("d58").Value = eq2
Windows("Anti-Sway Bar Analysis LVSR Softer Rate (18K).xls").Activate

Range("c57").Select

...stuff...

SolverReset
SolverOk SetCell:="$B$60", MaxMinVal:=3, ValueOf:="0",
ByChange:="$B$57:$B$58"
SolverAdd CellRef:="$B$57", Relation:=2, FormulaText:="$B$58"
SolverAdd CellRef:="$C$57", Relation:=2, FormulaText:="$C$58"
SolverOk SetCell:="$B$60", MaxMinVal:=3, ValueOf:="0",
ByChange:="$B$57:$B$58"
SolverSolve (True)

Application.DisplayAlerts = True
Application.ScreenUpdating = True

End Sub

Is there any way to access the chart trendline text without activating the
chart? How can I avoid this loop?

Thanks,
Pflugs
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create macro to calculate data range for a running chart James Lucero Excel Worksheet Functions 1 April 29th 08 04:27 PM
Calculate Event Martin Bauer Excel Programming 6 April 14th 06 08:43 AM
Change event and calculate event Antje Excel Programming 1 March 29th 05 09:03 PM
AFTER Calculate Event PosseJohn Excel Programming 4 January 16th 05 07:31 PM


All times are GMT +1. The time now is 09:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"