ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦³ÃöexcelVBA¹Ïªíªº°ÝÃD

§ä¨ì¤F¡A§Ú¬O¥ÎxlLine¹º½u¡A©Ò¥H¤~·|¦³¨C­Ó¶¡¶Z¥X²{¡A¤j®a¥i¥H¥Î xlXYScatterLinesNoMarkers ¸Õ¬Ý¬Ý¡C

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-6-12 06:25 ½s¿è
§ä¨ì¤F¡A§Ú¬O¥ÎxlLine¹º½u¡A©Ò¥H¤~·|¦³¨C­Ó¶¡¶Z¥X²{¡A¤j®a¥i¥H¥Î xlXYScatterLinesNoMarkers ¸Õ¬Ý¬Ý¡C
lin_6219 µoªí©ó 2013-6-12 01:13

½Ð¬Ý¤F¹Ï¥Ü«á¡A¦A¦æÆ[¹î¡CxlXYScatterLinesNoMarkers ¨Ã«D¬O¥D¦]¡A
ÃöÁäÂIÀ³¸Ó¬O "¤é´Á®É¶¡¶b" ¤§ÂkÄÝ¡A¥B¬O¦ì©ó xlPrimary ¥D®y¼Ð¶b¡C
¦]¬°§Aªº¤é´Á¬O¥Î¥Á°ê¦~¡A¬G¦b¹Ïªí½ÆÂø³B²z¤U¤é´ÁÅã¥Ü¥ç¦³¤£¦P¡C
»yªk¤º®e¤§¼W´î¡Aµ²ªG¥ç³y¦¨·|¨Ç³\¤§²§¦P¡C¥u¯à¦bCoding®ÉºÉ¤OÁ׶}¡C
¦p¥H ¹Ï1¡B¹Ï2 ¬°¨Ò¡A¦] "²¾°Ê¥­§¡½u" »P  "¤é´Á®É¶¡¶b" §¡¦ì©ó¥D®y¼Ð¶b¡F
¹Ï3~6 «h¬O¥HªÑ²¼¬Wª¬¹Ï (xlStockOHLC) ¬°¥D®y¼Ð¶b¡A¬O¬G ¹Ï1~2 ½×©w«K¤£¾A¥Î¡C
¦Ü©ó ¹Ï3~4¡B¹Ï5~6 ªºÅã¥Ü¤é´Á¬°¦ó¤Lªñ¹p¦Pªº¼Ò²Õ·|¦³¤£¦Pµ²ªG¨º´N­n
¥J²Ó¥hÆ[¹îµ{¦¡½X¤F¡C


TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-6-12 06:32 ½s¿è

¦^´_ 21# lin_6219
·Q¤F·QÁÙ¬O±Nµ{¦¡¼Ò²Õ¶K¤W¡A§A¦³ªÅ®É¦A¦æÆ[¹î¡C
  1. Sub KChartWithVolume()                         '  K½u¹Ï»P¦¨¥æ¶q¹Ï©ñ¦b¦P¤@¹Ïªí
  2.     Dim nRow As Integer, ChtObj As ChartObject
  3.     Dim i As Integer, j As Integer
  4.     Dim myMax, myMin, GapNr As Integer
  5.    
  6.     On Error Resume Next
  7.   
  8.     With Worksheets("¥Dµe­±")
  9.         .ChartObjects.Delete
  10.         nRow = Worksheets("ø¹Ï¸ê®Æ").Range("A65536").End(xlUp).Row
  11.         Set ChtObj = .ChartObjects.Add(1, 1, 450, 250)
  12.         
  13.         With ChtObj.Chart
  14.             .SetSourceData Worksheets("ø¹Ï¸ê®Æ").Range("A1:E" & CStr(nRow))
  15.             .ChartType = xlStockOHLC
  16.             .HasTitle = True
  17.             .ChartTitle.Characters.Text = "K½u»P¦¨¥æ¶q¹Ï"
  18.                
  19.             With .ChartGroups(1)
  20.                 .AxisGroup = xlPrimary
  21.                 .HasUpDownBars = True
  22.                 .UpBars.Interior.ColorIndex = 3
  23.                 .DownBars.Interior.ColorIndex = 1
  24.                 .GapWidth = 10
  25.             End With
  26.             
  27.             .SeriesCollection.Add Worksheets("ø¹Ï¸ê®Æ").Range("G2:G" & CStr(nRow))
  28.                
  29.             With .SeriesCollection(5)
  30.                 ' .ChartType = xlXYScatterLinesNoMarkers
  31.                 .ChartType = xlLine
  32.                 .AxisGroup = xlPrimary
  33.                 .Border.ColorIndex = 7
  34.                 .Name = "=ø¹Ï¸ê®Æ!$G$1"
  35.             End With
  36.             
  37.             With Worksheets("ø¹Ï¸ê®Æ")              '  ³]©w¥D®y¼Ð¶b³Ì¤j¤Î³Ì¤p­È
  38.                 myMax = Application.Max(.Range("C2:C" & CStr(nRow)))
  39.                 myMin = Application.Min(.Range("D2:D" & CStr(nRow)))
  40.                 myMin = myMin - (myMax - myMin)
  41.             End With
  42.             
  43.             With .Axes(xlValue)
  44.                 .MaximumScale = Round(myMax, 2)
  45.                 .MinimumScale = Round(myMin, 2)
  46.             End With
  47.             
  48.             .SeriesCollection.NewSeries              '  ·s¼W¦¨¥æ¶q¼Æ¦C
  49.             With .SeriesCollection(6)
  50.                 .Values = Worksheets("ø¹Ï¸ê®Æ").Range("F2:F" & CStr(nRow))
  51.                 .ChartType = xlColumnClustered
  52.                 .Name = "¦¨¥æ¶q"
  53.                 .Interior.ColorIndex = 17
  54.                 .AxisGroup = xlSecondary             '  ³]¬°°Æ®y¼Ð¶b
  55.             End With
  56.             
  57.             With Worksheets("ø¹Ï¸ê®Æ")              '  ­pºâ°Æ®y¼Ð¶b³Ì¤j¤Î³Ì¤p­È
  58.                 myMax = Application.Max(.Range("F2:F" & CStr(nRow)))
  59.                 myMax = myMax * 2
  60.                 myMin = 0.01
  61.             End With
  62.             
  63.             With .Axes(xlValue, xlSecondary)         '  ³]©w°Æ®y¼Ð¶b³Ì¤j¤Î³Ì¤p­È
  64.                 .MaximumScale = Round(myMax, 0)
  65.                 .MinimumScale = Round(myMin, 0)
  66.             End With
  67.             
  68.              With .Axes(xlCategory)                               '  X®y¼Ð¶b (®É¶¡¶b)
  69.                  .CategoryType = xlCategoryScale
  70.                  .TickLabelSpacing = 4                            '  ¼Ð¥Ü¶¡¶Z
  71.                  .TickLabels.NumberFormatLocal = "yyyy/m/d"
  72.                  .TickLabels.Font.ColorIndex = 5                  '  Blue Color
  73.             End With
  74.             
  75.             With .Legend                                          '  §R°£¤£¥²­nªº¹Ï¨Ò
  76.                 .LegendEntries(2).Delete                          '  ¶}½L»ù
  77.                 .LegendEntries(2).Delete                          '  ³Ì°ª»ù
  78.                 .LegendEntries(2).Delete                          '  ³Ì§C»ù
  79.                 .LegendEntries(2).Delete                          '  ¦¬½L»ù
  80.                 .Top = .Parent.ChartTitle.Top - 5
  81.             End With
  82.                
  83.             '  With .ChartArea
  84.             '      .Border.Weight = 2
  85.             '      .Border.LineStyle = 0
  86.             '      '  ¹ÏªíªºÃ¸¹Ï°Ï¥~¤§ X¡BY ¶b¦C¥Ü¸ê®Æ¼Æ¾Ú°Ï¶ô³¡¤À¤©¥H¶ñ¤J¹Ïªí¹w³](¨t²Î)¤§©³¦â¡B¥i¼W±jµøı®ÄªG¡C
  87.             '      .Fill.OneColorGradient Style:=msoGradientHorizontal, Variant:=1, Degree:=0.231372549019608
  88.             '      ' .Fill.Visible = True         '  ¥[¤J¹Ïªí©³¦âÅܼƤºµ¹¤_¤§¦â¨t¡C
  89.             '      ' .Fill.ForeColor.SchemeColor = ¹Ïªí©³¦â
  90.             '  End With
  91.             
  92.             With .PlotArea                                        '  ½Õ¾ãø¹Ï°Ï°ì¤j¤p»P¦ì¸m
  93.                 .Top = .Top - 10
  94.                 .Height = .Height + 10
  95.                 .Width = .Width + 95
  96.             End With
  97.             
  98.             .PlotArea.Select    '  ±N¹ÏªíªºÃ¸¹Ï°Ï®æ½u¦Ç¶ÂÃC¦â­×§ï¦¨²H«C¦â¡B¥H¤Îªí®æ¹ê½u§ï¥Hµê½uªí¥Ü
  99.             .Axes(xlValue).MajorGridlines.Select
  100.             With Selection.Format.Line
  101.                 .Visible = msoTrue
  102.                 .ForeColor.ObjectThemeColor = msoThemeColorAccent1
  103.                 .ForeColor.TintAndShade = 0
  104.                 .ForeColor.Brightness = 0.8000000119
  105.                 .Transparency = 0
  106.                 .Weight = 0.25
  107.                 .DashStyle = msoLineSysDash
  108.             End With
  109.         End With
  110.         .[A1].Select
  111.     End With
  112. End Sub
½Æ»s¥N½X

TOP

¦^´_ 21# lin_6219
  1. Sub KChartWithVolume2()                         '  K½u¹Ï»P¦¨¥æ¶q¹Ï©ñ¦b¦P¤@¹Ïªí
  2.     Dim nRow As Integer, ChtObj As ChartObject
  3.     Dim i As Integer, j As Integer, chartname As String
  4.     Dim myMax, myMin, GapNr As Integer
  5.    
  6.     On Error Resume Next
  7.   
  8.     With Worksheets("¥Dµe­±")
  9.         .ChartObjects.Delete
  10.         .Select
  11.         nRow = Worksheets("ø¹Ï¸ê®Æ").Range("A65536").End(xlUp).Row
  12.         '  Set ChtObj = Worksheets("¥Dµe­±").ChartObjects.Add(1, 1, 450, 250)
  13.         '  With ChtObj.Chart ~ End With
  14.         '  ¦¹½d¨Ò §ï¥H Worksheets("¥Dµe­±").Shapes.AddChart.Select ªº¤è¦¡³B²z¡F
  15.         '              With ActiveChart
  16.         '                  . . . . . . . . . . . .
  17.         '                  With .ChartArea
  18.         '                      .Height = 250
  19.         '                      .Width = 450
  20.         '                  End With
  21.         '                  . . . . . . . . . . . .
  22.         '                  chartname = Trim(Replace(ActiveChart.Name, ActiveSheet.Name, ""))
  23.         '                  .Shapes(chartname).Left = Cells(1, 1).Left
  24.         '                  .Shapes(chartname).Top = Cells(1, 1).Top
  25.         '                  . . . . . . . . . . . .
  26.         '              End With
  27.         '  ¦P²z¡A¥ç¥i¥H¨Ï¥Î Worksheets("¥Dµe­±").ChartObjects.Add() ªº¤è¦¡³B²z
  28.         '  ®t§O¥u¦b©ó With ActiveChart ~ End With ¶¡¡A­n¥t¦æ«Å§i¹Ïªí°ª¡B¼e«×¡A¥H¤Î®y¼Ð¦ì¸m¡C
  29.         '  ´«¨¥¤§¡A Worksheets("¥Dµe­±").ChartObjects.Add() ¬O¤@¦¸«K«Å§i§¹¦¨¡A«Å§iª«¥ó¤£¦P¡C
  30.         .Shapes.AddChart.Select
  31.         
  32.         '  With ChtObj.Chart
  33.         With ActiveChart
  34.             '  .SetSourceData Worksheets("ø¹Ï¸ê®Æ").Range("A2:E" & CStr(nRow))
  35.             .SetSourceData Source:=Range("ø¹Ï¸ê®Æ!$A$2:ø¹Ï¸ê®Æ!$E$" & CStr(nRow))
  36.             .ChartType = xlStockOHLC
  37.             .HasTitle = True
  38.             .ChartTitle.Characters.Text = "K½u»P¦¨¥æ¶q¹Ï"
  39.             
  40.             With .ChartGroups(1)
  41.                 .AxisGroup = xlPrimary
  42.                 .HasUpDownBars = True
  43.                 .UpBars.Interior.ColorIndex = 3
  44.                 .DownBars.Interior.ColorIndex = 1
  45.                 .GapWidth = 10
  46.             End With
  47.             
  48.             '  .SeriesCollection.Add Worksheets("ø¹Ï¸ê®Æ").Range("G1:G" & CStr(nRow))
  49.             .SeriesCollection.Add Source:=Range("ø¹Ï¸ê®Æ!$G$2:ø¹Ï¸ê®Æ!$G$" & CStr(nRow))
  50.                
  51.             With .SeriesCollection(5)
  52.                 .ChartType = xlXYScatterLinesNoMarkers
  53.                 '  .ChartType = xlLine
  54.                 .AxisGroup = xlPrimary
  55.                 ' ¦pªG ¥D®y¼Ð­È¬° xlStockOHLC¡A¦¹³B«Å§i·|³Q©¿µø¡Aµø¦P xlSecondary¡C
  56.                 .Border.ColorIndex = 7
  57.                 .Name = "=ø¹Ï¸ê®Æ!$G$1"
  58.             End With
  59.                            
  60.             With Worksheets("ø¹Ï¸ê®Æ")              '  ³]©w¥D®y¼Ð¶b³Ì¤j¤Î³Ì¤p­È
  61.                 myMax = Application.Max(.Range("C2:C" & CStr(nRow)))
  62.                 myMin = Application.Min(.Range("D2:D" & CStr(nRow)))
  63.                 myMin = myMin - (myMax - myMin)
  64.             End With
  65.             
  66.             With .Axes(xlValue)
  67.                 .MaximumScale = Round(myMax, 2)
  68.                 .MinimumScale = Round(myMin, 2)
  69.             End With
  70.             
  71.             '  .SeriesCollection.NewSeries      '  ·s¼W¦¨¥æ¶q¼Æ¦C (»P¤U­z«Å§iµ²ªG¤@­P)
  72.             .SeriesCollection.Add Source:=Range("ø¹Ï¸ê®Æ!$F$2:ø¹Ï¸ê®Æ!$F$" & CStr(nRow))
  73.             
  74.             With .SeriesCollection(6)
  75.                 '  ¦¹³B .Values ¦s©ñ­È½d³ò¥²¶·¬O«ü¦V "¦³¹êÅé¼Æ¾Ú¸ê®Æ" ½d³ò°Ï°ì¡C
  76.                 '  ¦pªG¨Ï¥Î .SeriesCollection.NewSeries «Å§i¡A«h¥²¶·«ü©ú .Values¡C
  77.                 ' .Values = Worksheets("ø¹Ï¸ê®Æ").Range("F2:F" & CStr(nRow))
  78.                 .ChartType = xlColumnClustered
  79.                 .Name = "¦¨¥æ¶q"                     '  "=ø¹Ï¸ê®Æ!$F$1" (¦¨¥æª÷ÃB)
  80.                 .Interior.ColorIndex = 17
  81.                 .AxisGroup = xlSecondary             '  ³]¬°°Æ®y¼Ð¶b
  82.             End With
  83.             
  84.             With Worksheets("ø¹Ï¸ê®Æ")              '  ­pºâ°Æ®y¼Ð¶b³Ì¤j¤Î³Ì¤p­È
  85.                 myMax = Application.Max(.Range("F2:F" & CStr(nRow)))
  86.                 myMax = myMax * 2
  87.                 myMin = 0.01
  88.             End With
  89.             
  90.             With .Axes(xlValue, xlSecondary)         '  ³]©w°Æ®y¼Ð¶b³Ì¤j¤Î³Ì¤p­È
  91.                 .MaximumScale = Round(myMax, 0)
  92.                 .MinimumScale = Round(myMin, 0)
  93.             End With
  94.             
  95.             With .Axes(xlCategory)                               '  X®y¼Ð¶b (®É¶¡¶b)
  96.                 .CategoryType = xlCategoryScale
  97.                 .TickLabelSpacing = 4                            '  ¼Ð¥Ü¶¡¶Z
  98.                 .TickLabels.NumberFormatLocal = "yyyy/m/d"
  99.                 .TickLabels.Font.ColorIndex = 5                  '  Blue Color
  100.             End With
  101.             
  102.             With .Legend                                          '  §R°£¤£¥²­nªº¹Ï¨Ò
  103.                 .LegendEntries(2).Delete                          '  ¶}½L»ù
  104.                 .LegendEntries(2).Delete                          '  ³Ì°ª»ù
  105.                 .LegendEntries(2).Delete                          '  ³Ì§C»ù
  106.                 .LegendEntries(2).Delete                          '  ¦¬½L»ù
  107.                 .Top = .Parent.ChartTitle.Top - 5
  108.             End With
  109.             
  110.             With .ChartArea
  111.                 .Height = 250                               '  ±N­ì¥»³]©w¤§°ª«×½Õ¦Ü¾A«×¦ì¸m
  112.                 .Width = 450
  113.                         
  114.                 .Border.Weight = 2
  115.                 .Border.LineStyle = 0
  116.                 '  ¹ÏªíªºÃ¸¹Ï°Ï¥~¤§ X¡BY ¶b¦C¥Ü¸ê®Æ¼Æ¾Ú°Ï¶ô³¡¤À¤©¥H¶ñ¤J¹Ïªí¹w³](¨t²Î)¤§©³¦â¡B¥i¼W±jµøı®ÄªG¡C
  117.                 .Fill.OneColorGradient Style:=msoGradientHorizontal, Variant:=1, Degree:=0.231372549019608
  118.                 ' .Fill.Visible = True         '  ¥[¤J¹Ïªí©³¦âÅܼƤºµ¹¤_¤§¦â¨t¡C
  119.                 ' .Fill.ForeColor.SchemeColor = ¹Ïªí©³¦â
  120.             End With
  121.             
  122.             With .PlotArea                                        '  ½Õ¾ãø¹Ï°Ï°ì¤j¤p»P¦ì¸m
  123.                 .Top = .Top - 10
  124.                 .Height = .Height + 15
  125.                 .Width = .Width + 95
  126.             End With
  127.             
  128.             .PlotArea.Select    '  ±N¹ÏªíªºÃ¸¹Ï°Ï®æ½u¦Ç¶ÂÃC¦â­×§ï¦¨²H«C¦â¡B¥H¤Îªí®æ¹ê½u§ï¥Hµê½uªí¥Ü
  129.             .Axes(xlValue).MajorGridlines.Select
  130.             With Selection.Format.Line
  131.                 .Visible = msoTrue
  132.                 .ForeColor.ObjectThemeColor = msoThemeColorAccent1
  133.                 .ForeColor.TintAndShade = 0
  134.                 .ForeColor.Brightness = 0.8000000119
  135.                 .Transparency = 0
  136.                 .Weight = 0.25
  137.                 .DashStyle = msoLineSysDash
  138.             End With
  139.         End With
  140.             
  141.         chartname = Trim(Replace(ActiveChart.Name, ActiveSheet.Name, ""))
  142.         .Shapes(chartname).Left = Cells(1, 1).Left     '  ³]©w¦¹¹Ïªí¹ê»ÚÂ\©ñªº X¡BY ®y¼Ð¦ì¸m¡C
  143.         .Shapes(chartname).Top = Cells(1, 1).Top

  144.         .[A1].Select
  145.     End With
  146. End Sub
½Æ»s¥N½X

TOP

¦^´_ 21# lin_6219
  1. Sub KChartWithVolume3()                         '  K½u¹Ï»P¦¨¥æ¶q¹Ï©ñ¦b¦P¤@¹Ïªí
  2.     Dim nRow As Integer, ChtObj As ChartObject
  3.     Dim i As Integer, j As Integer
  4.     Dim myMax, myMin, GapNr As Integer
  5.    
  6.     On Error Resume Next
  7.   
  8.     Worksheets("¥Dµe­±").ChartObjects.Delete
  9.     nRow = Worksheets("ø¹Ï¸ê®Æ").Range("A65536").End(xlUp).Row
  10.     Set ChtObj = Worksheets("¥Dµe­±").ChartObjects.Add(1, 1, 450, 250)
  11.    
  12.     With ChtObj.Chart
  13.         .SetSourceData Worksheets("ø¹Ï¸ê®Æ").Range("B2:E" & CStr(nRow))
  14.         .ChartType = xlStockOHLC
  15.         .HasTitle = True
  16.         .ChartTitle.Characters.Text = "K½u»P¦¨¥æ¶q¹Ï"
  17.    
  18.         With .ChartGroups(1)
  19.             .AxisGroup = xlPrimary
  20.             .HasUpDownBars = True
  21.             .UpBars.Interior.ColorIndex = 3
  22.             .DownBars.Interior.ColorIndex = 1
  23.             .GapWidth = 10
  24.         End With
  25.         
  26.         .SeriesCollection.Add Worksheets("ø¹Ï¸ê®Æ").Range("G2:G" & CStr(nRow))
  27.         
  28.         With .SeriesCollection(5)
  29.             .ChartType = xlXYScatterLinesNoMarkers
  30.             '  .ChartType = xlLine
  31.             .AxisGroup = xlPrimary
  32.             .Border.ColorIndex = 7
  33.             .Name = "=ø¹Ï¸ê®Æ!$G$1"
  34.         End With
  35.         
  36.         With Worksheets("ø¹Ï¸ê®Æ")              '  ³]©w¥D®y¼Ð¶b³Ì¤j¤Î³Ì¤p­È
  37.             myMax = Application.Max(.Range("C2:C" & CStr(nRow)))
  38.             myMin = Application.Min(.Range("D2:D" & CStr(nRow)))
  39.             myMin = myMin - (myMax - myMin)
  40.         End With
  41.         
  42.         With .Axes(xlValue)
  43.             .MaximumScale = Round(myMax, 2)
  44.             .MinimumScale = Round(myMin, 2)
  45.         End With
  46.         
  47.         .SeriesCollection.NewSeries              '  ·s¼W¦¨¥æ¶q¼Æ¦C
  48.         With .SeriesCollection(6)
  49.             .Values = Worksheets("ø¹Ï¸ê®Æ").Range("F2:F" & CStr(nRow))
  50.             .ChartType = xlColumnClustered
  51.             .Name = "¦¨¥æ¶q"
  52.             .Interior.ColorIndex = 17
  53.             .AxisGroup = xlSecondary             '  ³]¬°°Æ®y¼Ð¶b
  54.         End With
  55.         
  56.         With Worksheets("ø¹Ï¸ê®Æ")              '  ­pºâ°Æ®y¼Ð¶b³Ì¤j¤Î³Ì¤p­È
  57.             myMax = Application.Max(.Range("F2:F" & CStr(nRow)))
  58.             myMax = myMax * 2
  59.             myMin = 0.01
  60.         End With
  61.         
  62.         With .Axes(xlValue, xlSecondary)         '  ³]©w°Æ®y¼Ð¶b³Ì¤j¤Î³Ì¤p­È
  63.             .MaximumScale = Round(myMax, 0)
  64.             .MinimumScale = Round(myMin, 0)
  65.         End With
  66.         
  67.         With .Axes(xlCategory)                               '  X®y¼Ð¶b (®É¶¡¶b)
  68.             .CategoryType = xlCategoryScale
  69.             .TickLabelSpacing = 4                            '  ¼Ð¥Ü¶¡¶Z
  70.             .TickLabels.NumberFormatLocal = "yyyy/m/d"
  71.             .TickLabels.Font.ColorIndex = 5                  '  Blue Color
  72.         End With
  73.         
  74.         With .Legend                                          '  §R°£¤£¥²­nªº¹Ï¨Ò
  75.             .LegendEntries(2).Delete                          '  ¶}½L»ù
  76.             .LegendEntries(2).Delete                          '  ³Ì°ª»ù
  77.             .LegendEntries(2).Delete                          '  ³Ì§C»ù
  78.             .LegendEntries(2).Delete                          '  ¦¬½L»ù
  79.             .Top = .Parent.ChartTitle.Top - 5
  80.         End With
  81.         
  82.         With .PlotArea                                        '  ½Õ¾ãø¹Ï°Ï°ì¤j¤p»P¦ì¸m
  83.             .Top = .Top - 10
  84.             .Height = .Height + 10
  85.             .Width = .Width + 95
  86.         End With
  87.         
  88.         .PlotArea.Select    '  ±N¹ÏªíªºÃ¸¹Ï°Ï®æ½u¦Ç¶ÂÃC¦â­×§ï¦¨²H«C¦â¡B¥H¤Îªí®æ¹ê½u§ï¥Hµê½uªí¥Ü
  89.         .Axes(xlValue).MajorGridlines.Select
  90.         With Selection.Format.Line
  91.             .Visible = msoTrue
  92.             .ForeColor.ObjectThemeColor = msoThemeColorAccent1
  93.             .ForeColor.TintAndShade = 0
  94.             .ForeColor.Brightness = 0.8000000119
  95.             .Transparency = 0
  96.             .Weight = 0.25
  97.             .DashStyle = msoLineSysDash
  98.         End With
  99.     End With
  100.     Worksheets("¥Dµe­±").[A1].Select
  101. End Sub
½Æ»s¥N½X

TOP

¦^´_ 21# lin_6219
  1. Sub Test()
  2.     Dim nRow As Integer, ChtObj As ChartObject
  3.     Dim i As Integer, j As Integer, chartname As String
  4.     Dim myMax, myMin, GapNr As Integer
  5.    
  6.     On Error Resume Next
  7.   
  8.     With Worksheets("¥Dµe­±")
  9.         .ChartObjects.Delete
  10.         .Select
  11.         nRow = Worksheets("ø¹Ï¸ê®Æ").Range("A65536").End(xlUp).Row
  12.         Set ChtObj = Worksheets("¥Dµe­±").ChartObjects.Add(1, 1, 450, 250)
  13.         
  14.         With ChtObj.Chart
  15.             '  .SetSourceData Source:=Range("ø¹Ï¸ê®Æ!$A$2:ø¹Ï¸ê®Æ!$A$20, ø¹Ï¸ê®Æ!$F$2:ø¹Ï¸ê®Æ!$F$20")
  16.             .SetSourceData Source:=Range("ø¹Ï¸ê®Æ!$A$2:ø¹Ï¸ê®Æ!$A$" & CStr(nRow) & ", ø¹Ï¸ê®Æ!$F$2:ø¹Ï¸ê®Æ!$F$" & CStr(nRow))
  17.             .ChartType = xlXYScatterLinesNoMarkers
  18.             ' .ChartType = xlLine
  19.             .HasTitle = True
  20.             .ChartTitle.Characters.Text = "K½u»P¦¨¥æ¶q¹Ï"
  21.             
  22.             With .SeriesCollection(1)
  23.                 .Border.ColorIndex = 7
  24.                 .Name = "=ø¹Ï¸ê®Æ!$F$1"
  25.             End With
  26.             
  27.             With .Axes(xlCategory)                               '  X®y¼Ð¶b (®É¶¡¶b)
  28.                 .CategoryType = xlCategoryScale
  29.                 .TickLabelSpacing = 4                            '  ¼Ð¥Ü¶¡¶Z
  30.                 .TickLabels.NumberFormatLocal = "yyyy/m/d"
  31.                 .TickLabels.Font.ColorIndex = 5                  '  Blue Color
  32.                 ' .TickLabels.Orientation = xlTickLabelOrientationUpward
  33.             End With
  34.         End With
  35.     End With
  36. End Sub
½Æ»s¥N½X

TOP

¦^´_ 26# c_c_lai
¦nªº¡A§Ú¦A¦n¦n¥J²Ó¬ã¨s¬Ý¬Ý¡A¹Ïªí³o­Ó³¡¤À¡Aª¬ªp¯uªº«Ü¦h©O¡A¤Q¤À·PÁ§A:)))

TOP

¦^´_ 26# c_c_lai
¤£¦n·N«ä¡A§Ú·Q¦A½Ð°Ý»¡¡A¦pªG¬O¦¨¥æ¶q³oºØ¹Ï¡A¦Ó¥B¬O¥Î¦è¤¸¦~¡A¨º¦³¿ìªkÁקK±¼¶Ü? ·PÁ¡C
¹ÏªíÃþ«¬¬° xlColumnClustered

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-6-13 06:42 ½s¿è

¦^´_ 28# lin_6219
°ò¥»¤W¡A¹Ïªí¦b¹B§@®É¡A¥¦¨Ã¤£·|²z·|¬O¦è¤¸¡B©Î¥Á°ê¦~¡A
¥u¬O¦bÅã¥Ü®Éµo¥ÍÂà´«¤Wªº°ÝÃD¡C
­ì«h¤W¡A¦pªG§Ú¿ï¥Î¥Á°ê¦~§@¬°Àɮתº¤é´ÁÄæ¡A¦b¦¹±¡ªp¤U
.TickLabels.NumberFormatLocal = "m/d" À³¸Ó·|¬O§Úªº¿ï¾Ü¡C
¦Ü©ó¦b xlColumnClustered  ¤U¡A§Ú¬O¨S¸Õ¹LÂI¦ìªº°ÝÃD¡C

TOP

¦^´_ 28# lin_6219
¸g´ú¸Õ xlColumnClustered¡BxlColumnStacked¡Bxl3DColumnStacked¡B
xl3DColumnClustered µ¥¡Aµ²ªG³£¬O¤@¯ë¥¿±`ªºÂI¦ì¡C¦p¹Ï¡G

³o¤è­±¥i¯à­nª½±µ½Ð±Ð Microsoft ©Î¦Û¦æ¤Wºô·j´M¬ÛÃö¸ê®Æ¤F¡C

TOP

        ÀR«ä¦Û¦b : ­×¦æ­nô½t­×¤ß¡AÂǨƽm¤ß¡AÀH³B¾i¤ß¡C
ªð¦^¦Cªí ¤W¤@¥DÃD