I have the following Code and I wouls like to plot on an XY Scatter Plot (smoothed lines and no data points) the elements of the array "Bins()" on the X-axis and elements of the array "Classes()" on the y-axis.
[vba]Sub InsertChartPlease()
Dim i As Long
Dim j As Long
Dim nRow As Long
Dim nCol As Long
Dim Sheet1 As Worksheet
Dim Classes(3) As Long 'Each Element of Classes is a class (bin)
Dim Bins(3) As Long
Bins = (10, 20, 30)
Classes = (0, 0, 0)
nRow = 300
nCol = 130
Set Sheet1 = Worksheets("Sheet1")
With Sheet1
For i = 1 To nRow
For j = 1 To nCol
If Cells(i, j) <> "" Then
' Frequency for each class
Select Case Cells(i, j)
Case Is <= 10
Classes(0) = Classes(0) + 1
Case Is <= 20
Classes(1) = Classes(1) + 1
Case Is <= 30
Classes(2) = Classes(2) + 1
End Select
End If
Next j
Next i
End With
End Sub
[/vba]
I would also like to be able to set the position and size of the plot. But what does Excel use to do that? Do we specify by pixels or inches or a % of the screen size...etc?
Any advice would be great!
Thanks
PS
Does this not work? [VBA]
Bins = (10, 20, 30)
Classes = (0, 0, 0)
[/VBA]
How can I initialize the whole array at once?