Excel problems!!!! 
Author Message
 Excel problems!!!!

I' have a table with 2 columns, and I' want make a  "XY(Scatter)" chart,
this is the code (I' m programming  in VB6):

Sub CreateChart(folha As String, irowini As Integer, irow As Integer)
'
' CreateChart Macro
' Macro recorded 16-03-2000 by RPBJ
'

'
    Charts.Add
    ActiveChart.ChartType = xlColumnClustered
    ActiveChart.SetSourceData
Source:=Sheets(folha).Range(Sheets(folha).Cells(irowini, 1),
Sheets(folha).Cells(irow - 1, 2)), PlotBy _
        :=xlColumns
    ActiveChart.Location Where:=xlLocationAsObject, Name:=folha
    With ActiveChart
        .HasTitle = True
        .ChartTitle.Characters.Text = "Caudal"
        .Axes(xlCategory, xlPrimary).HasTitle = False
        .Axes(xlValue, xlPrimary).HasTitle = False
    End With
    ActiveChart.HasLegend = True
    ActiveChart.Legend.Select
    Selection.Position = xlRight
End Sub

Sub Series(folha As String, irowini As Integer, irow As Integer)
'
' Series Macro
' Macro recorded 18-03-2000 by RPBJ
'

'
    Range(Sheets(folha).Cells(irowini, 1), Sheets(folha).Cells(irow - 1,
2)).Select
    Charts.Add
    ActiveChart.ChartType = xlXYScatterLines
    ActiveChart.SetSourceData
Source:=Sheets(folha).Range(Sheets(folha).Cells(irowini, 1),
Sheets(folha).Cells(irow - 1, 2)), PlotBy:= _
        xlRows
    ActiveChart.SeriesCollection(1).XValues =
Worksheets(folha).Range(Sheets(folha).Cells(irowini, 1),
Sheets(folha).Cells(irow - 1, 1))
    ActiveChart.SeriesCollection(1).Values =
Worksheets(folha).Range(Sheets(folha).Cells(irowini, 2),
Sheets(folha).Cells(irow - 1, 2))
    ActiveChart.Location Where:=xlLocationAsObject, Name:=folha
    With ActiveChart.Axes(xlCategory)
        .HasMajorGridlines = True
        .HasMinorGridlines = False
    End With
    With ActiveChart.Axes(xlValue)
        .HasMajorGridlines = True
        .HasMinorGridlines = False
    End With
    ActiveChart.ApplyDataLabels Type:=xlDataLabelsShowNone, LegendKey:=False
    ActiveChart.Axes(xlValue).Select
    With ActiveChart.Axes(xlValue)
        .MinimumScaleIsAuto = True
        .MaximumScaleIsAuto = True
        .MinorUnitIsAuto = True
        .MajorUnit = 50
        .Crosses = xlAutomatic
        .ReversePlotOrder = False
        .ScaleType = xlLinear
        .DisplayUnit = xlNone
    End With
    ActiveChart.Axes(xlCategory).Select
    With ActiveChart.Axes(xlCategory)
        .MinimumScaleIsAuto = True
        .MaximumScale = 1
        .MinorUnitIsAuto = True
        .MajorUnit = 0.0416666
        .Crosses = xlAutomatic
        .ReversePlotOrder = False
        .ScaleType = xlLinear
        .DisplayUnit = xlNone
    End With
    Selection.TickLabels.AutoScaleFont = True
    With Selection.TickLabels.Font
        .Name = "Arial"
        .FontStyle = "Normal"
        .Size = 9
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
        .Background = xlAutomatic
    End With
    Selection.TickLabels.Orientation = xlUpward
    With ActiveChart.Axes(xlCategory)
        .MinimumScale = 0
        .MaximumScale = 1
        .MinorUnitIsAuto = True
        .MajorUnit = 0.0416666
        .Crosses = xlAutomatic
        .ReversePlotOrder = False
        .ScaleType = xlLinear
        .DisplayUnit = xlNone
    End With
End Sub

1) irowini this is the first row
2) irow this is the number of rows

The program work fine, but if I'have 5 rows I' have 5 series!!! The first
series is ok (the name is wrong,"Dados!$A$2, and i'whant the label
"Caudal"). I'want just one serie.
The others series they are wrong, they are like this:

Name:=Dados!$A$3
X Values:===Dados!$B$1
Y Values:===Dados!$B$3

Name:=Dados!$A$4
X Values:===Dados!$B$1
Y Values:===Dados!$B$4

Thanks
Paulo Pra?a



Wed, 04 Sep 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. VB and Excel problem - VB corrupts Excel environment

2. Linking to Excel Problems

3. Access to Excel problem...

4. Linking Word and Excel, problem saving

5. Excel - Problems adding new controls

6. Excel problem

7. word to excel problem

8. XP Word/Excel Problem

9. excel-problem

10. an EXCEL problem

11. Newbie Excel Problems

12. Excel problem

 

 
Powered by phpBB® Forum Software