Hi there
I am new to VBA programming and have to confront with problem of 86 plotting charts in 86 different sheets in Excel Workbook.
The chart range is same for all the sheets that is $A$15:$B$10014.
I tried to record a macro for one chart on a sheet and then tried to loop it through but some how it does not functions. Could some one provide suggestions ?
Sub Makro9()
'
' Makro9 Makro
'
'
Range("A15:B15").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Range("tek0006CH1.csv!$A$15:$B$10014")
End Sub
MS Support provides a way and I also tried it.
http://support.microsoft.com/kb/213621
Sub WorksheetLoop()
Dim WS_Count As Integer
Dim I As Integer
' Set WS_Count equal to the number of worksheets in the active
' workbook.
WS_Count = ActiveWorkbook.Worksheets.Count
' Begin the loop.
For I = 1 To WS_Count
Range("A15:B15").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Range("tek0006CH1.csv!$A$15:$B$10014")
Next I
End Sub
Can someone help me in spotting error ?
Thanks
Bookmarks