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 Insert–>Name–>Define
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 (e-mail address removed) with
sample file
Thanks and regards
Muhammed Rafeek M