Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 1
Default Remove old month from chart add new/no manual reference change

jan feb mar apr
10 20 30 40

I want to graph the latest 4 months without having to go in a change
refrences in the chart each month.

Next month
feb mar apr may
20 30 40 50

If I drag the last months across to pick up the formulas for the next month
I get 5 months on the graph instead of 4
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 1
Default Remove old month from chart add new/no manual reference change

Hi Kameel
Its possible only.

Example:
First Row months (A1: Jan, B1: Feb,..)
Second Row values (A2: 10, B2: 20,..)
Put any column (eg. K10) this function:
=ADDRESS(1,COUNTA(A1:AA1)-3)&":"&ADDRESS(2,COUNTA(A1:AA1))
You will get the cell address of new four months.
Click InsertNameDefine
Enter CName in Names in workbook field
Refers to area: =INDIRECT(Sheet1!$K$10)
Then click OK.
Open Visual Basic Editor (Alt+F11)
Go particular sheet object area
Paste below mentioned code

VB Code
Dim tmpBC As String
Private Sub Worksheet_Activate()
tmpBC = Range("K10").Value
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If tmpBC < Range("K10").Value Then
Call Refesh_Chart
End If
End Sub


Private Sub Refesh_Chart()
Application.ScreenUpdating = False
ActiveSheet.ChartObjects("Chart 4").Activate 'put your chart name
ActiveChart.ChartArea.Select
Dim rng As Range
Set rng = Range("Cname")
ActiveChart.SetSourceData Source:=rng, PlotBy:= _
xlRows
Range("A1").Select
Application.ScreenUpdating = True
End Sub

If you are not able to understand please mail to with
sample file

Thanks and regards
Muhammed Rafeek M


"Kameel" wrote:

jan feb mar apr
10 20 30 40

I want to graph the latest 4 months without having to go in a change
refrences in the chart each month.

Next month
feb mar apr may
20 30 40 50

If I drag the last months across to pick up the formulas for the next month
I get 5 months on the graph instead of 4

  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 1,071
Default Remove old month from chart add new/no manual reference change

In article ,
says...
jan feb mar apr
10 20 30 40

I want to graph the latest 4 months without having to go in a change
refrences in the chart each month.

Next month
feb mar apr may
20 30 40 50

If I drag the last months across to pick up the formulas for the next month
I get 5 months on the graph instead of 4


See
Dynamic Charts
http://www.tushar-mehta.com/excel/ne...rts/index.html
particularly, example 2.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
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
Make a line in a bar chart, and change color of any bars that exceed the line MarkM Excel Discussion (Misc queries) 4 July 5th 06 04:06 PM
Chart - slect month by Combo box deejayh Charts and Charting in Excel 1 June 15th 06 02:27 AM
How do I change the colors of each slice in a pie chart easily? GundyUrgie Charts and Charting in Excel 1 November 3rd 05 03:10 AM
change default chart settings for new excel charts automatically Nedwardt Charts and Charting in Excel 0 October 20th 05 08:27 PM
change chart title with auto filter Aja Charts and Charting in Excel 1 July 16th 05 06:34 AM


All times are GMT +1. The time now is 11:39 PM.

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

About Us

"It's about Microsoft Excel"