Dé Domhnaigh, 09 Deireadh Fómhair 2022
  1 Freagraí
  Cuairteanna 5K
0
Vótaí
Undo
Tá sonraí agam le 3 cholún. Is é colún 1 ainm na sraithe, is é x-luach colún 2, is é colún 3 ná y-luach. Is sonraí scaipthe XY iad na sonraí. Ar cheart dom colún 1 a chumasc le haon chill amháin?

An féidir liom na sonraí seo a bhreacadh ar an gcairt chéanna ionas go mbeidh sraith sonraí xy iolracha agam ag baint úsáide as Kutools?
Go raibh maith agat! Tá na bogearraí díreach ceannaithe agam agus mar sin táim ag lorg cúnaimh.
1 bliain ó shin
·
#3127
0
Vótaí
Undo
Dia duit ann,

Tá cód VBA cruthaithe againn, cuir isteach é le do thoil i modúl agus seiceáil an é sin atá uait:
Sub KutoolsChart()
'
' CSH
'
Dim xRg As Range
Dim i As Integer
On Error Resume Next
Set xRg = Application.InputBox(prompt:="Please select Range", Title:="Kutools for Excel", Type:=8)
If TypeName(xRg) = "Nothing" Then Exit Sub
If xRg.Columns.Count <> 3 Then
MsgBox ("Reference is not Valid")
Exit Sub
End If
ActiveSheet.Shapes.AddChart2(240, xlXYScatter).Select

For i = 1 To xRg.Rows.Count
ActiveChart.SeriesCollection.NewSeries
ActiveChart.FullSeriesCollection(i).Name = xRg.Cells(i, 1).Value
ActiveChart.FullSeriesCollection(i).XValues = xRg.Cells(i, 2)
ActiveChart.FullSeriesCollection(i).Values = xRg.Cells(i, 3)
ActiveChart.FullSeriesCollection(i).ApplyDataLabels
ActiveChart.FullSeriesCollection(i).DataLabels.Select
ActiveChart.FullSeriesCollection(i).DataLabels.ShowValue = False
ActiveChart.FullSeriesCollection(i).HasLeaderLines = False
ActiveChart.FullSeriesCollection(i).DataLabels.ShowSeriesName = True
Next
End Sub

Tar éis duit an cód thuas a chóipeáil agus a ghreamú, brúigh F5 chun an cód a rith. Agus beidh bosca dialóige pop suas ag iarraidh ort a roghnú na trí cholún.

Má tá aon cheist agat, ná bíodh drogall ort ceist a chur orm.

Amanda
  • Page:
  • 1
Níl aon fhreagraí déanta don phost seo go fóill.