satyampakker
06-09-2008, 08:24 AM
hi
this post is related to the post i recently posted ploting graphs according to the sheet selcted.
Thank you very much!! i solved my problem concrend with that post..
as i got a reply for that post saying that
"i tryed to get this error, on your sample workbook, but coudn't. although i did notice that you had well over 20 graphs stacked on top of each other. you might consider modifying the existing graph, rather then constently making new graphs"
I am unable to solve the stacking problem ,this problem is occurs when i open my file in other computer
how to overcome this problem??
please help me ..
i am attaching my file and pasting my code which makes the chart
Sub MakeChart()
Dim rng1 As Range, rng2 As Range
Dim gs As String
gs = ComboBox1.Value
Application.ScreenUpdating = True
'First selected
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
Set rng1 = Columns(1).Find(ListBox1.List(i))
Exit For
End If
Next
'Last selected
For i = ListBox1.ListCount - 1 To 1 Step -1
If ListBox1.Selected(i) Then
Set rng2 = Columns(1).Find(ListBox1.List(i))
Exit For
End If
Next
Charts.Add
With ActiveChart
.ChartType = xlColumnClustered
.SetSourceData Source:=Sheets(gs).Range(rng1, rng2).Offset(, 1).Resize(, 2), PlotBy _
:=xlColumns
.SeriesCollection(1).Name = "=""x"""
.SeriesCollection(2).Name = "=""Average"""
.Location Where:=xlLocationAsObject, Name:=gs
End With
Application.CommandBars("Chart").Visible = False
Range("A1").Select
Application.ScreenUpdating = True
End Sub
thanks
satyam
this post is related to the post i recently posted ploting graphs according to the sheet selcted.
Thank you very much!! i solved my problem concrend with that post..
as i got a reply for that post saying that
"i tryed to get this error, on your sample workbook, but coudn't. although i did notice that you had well over 20 graphs stacked on top of each other. you might consider modifying the existing graph, rather then constently making new graphs"
I am unable to solve the stacking problem ,this problem is occurs when i open my file in other computer
how to overcome this problem??
please help me ..
i am attaching my file and pasting my code which makes the chart
Sub MakeChart()
Dim rng1 As Range, rng2 As Range
Dim gs As String
gs = ComboBox1.Value
Application.ScreenUpdating = True
'First selected
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
Set rng1 = Columns(1).Find(ListBox1.List(i))
Exit For
End If
Next
'Last selected
For i = ListBox1.ListCount - 1 To 1 Step -1
If ListBox1.Selected(i) Then
Set rng2 = Columns(1).Find(ListBox1.List(i))
Exit For
End If
Next
Charts.Add
With ActiveChart
.ChartType = xlColumnClustered
.SetSourceData Source:=Sheets(gs).Range(rng1, rng2).Offset(, 1).Resize(, 2), PlotBy _
:=xlColumns
.SeriesCollection(1).Name = "=""x"""
.SeriesCollection(2).Name = "=""Average"""
.Location Where:=xlLocationAsObject, Name:=gs
End With
Application.CommandBars("Chart").Visible = False
Range("A1").Select
Application.ScreenUpdating = True
End Sub
thanks
satyam