Perksy_no1
Well-known Member
- Joined
- Oct 27, 2011
- Messages
- 598
- Office Version
- 365
- Platform
- Windows
Hi there,
I've got a workbook which automatically imports so high level data from an access data base and converts it to a pivot chart (this works fine thanks from a little help from Mr Excel )
The problem I've been possed by my boss is this. Everytime he changes different field setting he wants a trend line to appear. You can set it manually after each change but it disapears if you look at differnt info.
I've recorded myself addig that line and tried to put it in a work sheet change event (unsuccessfully).
Is there a way to do this??
I've posted what code I've got so far below.
Any help would be much appreciated and keep me in the bosses good books! Thanks in adavnce Mark
I've got a workbook which automatically imports so high level data from an access data base and converts it to a pivot chart (this works fine thanks from a little help from Mr Excel )
The problem I've been possed by my boss is this. Everytime he changes different field setting he wants a trend line to appear. You can set it manually after each change but it disapears if you look at differnt info.
I've recorded myself addig that line and tried to put it in a work sheet change event (unsuccessfully).
Is there a way to do this??
I've posted what code I've got so far below.
Any help would be much appreciated and keep me in the bosses good books! Thanks in adavnce Mark
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveChart.SeriesCollection(1).Trendlines.Add(Type:=xlLinear, Forward:=0, _
Backward:=0, DisplayEquation:=False, DisplayRSquared:=False).Select
End Sub