Krish - that new version is great. Below is part of my code - it generates charts (2n code section) - so in order for me to use your code - I have to switch sheets - then come back to the sheet - Then I assume it executes GetChartObjects - It all works great (guess I will just make the call to GetChartObjets from my code) - however in the second code part is my chart generation code - At first I just had the next chart on top of the previous chart .top+40 & .Left + 40 - in other words all my charts are stacked - I may have 4 to 8 charts stacked - however that freezes up Excel in a very bad way - It looks like as long as the charts dont overlay - everything works - so the code I show is where I make sure the charts dont touch. I think that is what the problem is. I am not complaining - just trying to make it better - cuz I like your routine.
Part of my chart making codeCode:Private Sub Workbook_SheetActivate(ByVal Sh As Object) GetChartObjects Sh 'Krish code End Sub Private Sub Workbook_Open() Load FormSlt FormSlt.Show vbModeless GetChartObjects ActiveSheet 'Krish code End Sub
Code:ActiveSheet.ChartObjects.Add Left:=50, Top:=50, Width:=600, Height:=300 NumCharts = ActiveSheet.ChartObjects.Count If NumCharts > 1 Then ActiveSheet.ChartObjects(NumCharts).Left = ActiveSheet.ChartObjects(NumCharts - 1).Left '+ 40 ActiveSheet.ChartObjects(NumCharts).Top = ActiveSheet.ChartObjects(NumCharts - 1).Top + 40 + ActiveSheet.ChartObjects(NumCharts - 1).Height ActiveSheet.ChartObjects(NumCharts).Height = ActiveSheet.ChartObjects(NumCharts - 1).Height ActiveSheet.ChartObjects(NumCharts).Width = ActiveSheet.ChartObjects(NumCharts - 1).Width End If ActiveSheet.ChartObjects(NumCharts).Activate Dim Achart As ChartObject Set Achart = ActiveSheet.ChartObjects(NumCharts) With Achart.Chart .ChartType = xlLine




Reply With Quote

Bookmarks