- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 4# lin_6219
¸Õ¸Õ¬Ý¡I- Sub KChartWithVolume() ' K ½u¹Ï »P ¦¨¥æ¶q¹Ï ©ñ¦b¦P¤@¹Ïªí
- Dim nRow As Integer, ChtObj As ChartObject
- Dim i As Integer, j As Integer
- Dim myMax, myMin, GapNr As Integer
-
- On Error Resume Next
-
- Worksheets("¥Dµe±").ChartObjects.Delete
- nRow = Worksheets("ø¹Ï¸ê®Æ").Range("A65536").End(xlUp).Row
-
- With Worksheets("ø¹Ï¸ê®Æ") ' ³]©w¥D®y¼Ð¶b³Ì¤j¤Î³Ì¤pÈ
- myMax = Application.Max(.Range("C2:C" & CStr(nRow)))
- myMin = Application.Min(.Range("D2:D" & CStr(nRow)))
- myMin = myMin - (myMax - myMin)
- End With
-
- ' Set ChtObj = Worksheets("¥Dµe±").ChartObjects.Add(1, 1, 450, 250)
- Set ChtObj = Worksheets("¥Dµe±").ChartObjects.Add(1, 1, 490, 280)
-
- With ChtObj.Chart
- ' .SetSourceData Worksheets("ø¹Ï¸ê®Æ").Range("A2:E" & CStr(nRow))
- .SetSourceData Source:=Range("ø¹Ï¸ê®Æ!$A$2:ø¹Ï¸ê®Æ!$E$" & CStr(nRow))
- .ChartType = xlStockOHLC
- .HasTitle = True
- .ChartTitle.Characters.Text = "K½u»P¦¨¥æ¶q¹Ï"
-
- With .ChartGroups(1)
- .HasUpDownBars = True
- .UpBars.Interior.ColorIndex = 3
- .DownBars.Interior.ColorIndex = 1
- .GapWidth = 10
- End With
-
- .SeriesCollection(1).Name = "" ' ¶}½L»ù
- .SeriesCollection(2).Name = "" ' ³Ì°ª»ù
- .SeriesCollection(3).Name = "" ' ³Ì§C»ù
- .SeriesCollection(4).Name = "" ' ¦¬½L»ù (¦¨¥æ»ù)
-
- With .Axes(xlValue)
- .MaximumScale = Round(myMax, 2)
- .MinimumScale = Round(myMin, 2)
- ' .MaximumScale = myMax
- ' .MinimumScale = myMin
- .MajorUnit = 0.5 ' ¹Ïªí¥ª°¼¼Æ¦C¤§¶¡¶Zȳ]©w
- End With
-
- ' .SeriesCollection.Add Worksheets("ø¹Ï¸ê®Æ").Range("G1:G" & CStr(nRow))
- .SeriesCollection.Add Source:=Range("ø¹Ï¸ê®Æ!$G$1:ø¹Ï¸ê®Æ!$G$" & CStr(nRow))
- With .SeriesCollection(5)
- .AxisGroup = 1
- ' .ChartType = xlXYScatterLinesNoMarkers
- .ChartType = xlLines
- .Name = "=ø¹Ï¸ê®Æ!$G$1" ' ²¾°Ê¥§¡½u
- .Border.ColorIndex = 7
- End With
-
- ' .SeriesCollection.NewSeries ' ·s¼W¦¨¥æ¶q¼Æ¦C
- .SeriesCollection.Add Source:=Range("ø¹Ï¸ê®Æ!$F$1:ø¹Ï¸ê®Æ!$F$" & CStr(nRow))
- With .SeriesCollection(6)
- .AxisGroup = 2 ' ³]¬°°Æ®y¼Ð¶b
- ' .Values = Worksheets("ø¹Ï¸ê®Æ").Range("F2:F" & CStr(nRow))
- .ChartType = xlColumnClustered
- .Name = "¦¨¥æ¶q"
- .Interior.ColorIndex = 17
- End With
-
- With Worksheets("ø¹Ï¸ê®Æ") ' pºâ°Æ®y¼Ð¶b³Ì¤j¤Î³Ì¤pÈ
- myMax = Application.Max(.Range("F2:F" & CStr(nRow)))
- myMax = myMax * 2
- myMin = 0.01
- End With
-
- With .Axes(xlValue, xlSecondary) ' ³]©w°Æ®y¼Ð¶b³Ì¤j¤Î³Ì¤pÈ
- .MaximumScale = Round(myMax, 0)
- .MinimumScale = Round(myMin, 0)
- End With
-
- With .PlotArea ' ½Õ¾ãø¹Ï°Ï°ì¤j¤p»P¦ì¸m
- .Top = .Top - 2
- .Height = .Height + 10
- .Width = .Width + 75
- End With
-
- .PlotArea.Select ' ±N¹ÏªíªºÃ¸¹Ï°Ï®æ½u¦Ç¶ÂÃC¦âק令²H«C¦â¡B¥H¤Îªí®æ¹ê½u§ï¥Hµê½uªí¥Ü
- .Axes(xlValue).MajorGridlines.Select
- With Selection.Format.Line
- .Visible = msoTrue
- .ForeColor.ObjectThemeColor = msoThemeColorAccent1
- .ForeColor.TintAndShade = 0
- .ForeColor.Brightness = 0.8000000119
- .Transparency = 0
- .Weight = 0.25
- .DashStyle = msoLineSysDash
- End With
-
- With .Legend
- .Position = xlLegendPositionTop
- .Top = .Top - 8
- .Border.ColorIndex = 57
- .Border.Weight = xlThin
- .Border.LineStyle = xlContinuous
- .Interior.ColorIndex = xlNone
- End With
- End With
- Worksheets("¥Dµe±").[A1].Select
- End Sub
½Æ»s¥N½X |
|