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

[µo°Ý] ¥D®y¼Ð¶b»P°Æ®y¼Ð¶b¸s²Õ¶¡À³¦p¦ó¥¿½T³]©w

¦^´_ 1# c_c_lai
ª©¥»¤£¹Ï ¤£©ö°»¿ù ,¼g­Ó½d¨Ò§A°Ñ¦Ò¤@¤U
  1. Private Sub »s¹Ï()
  2.     Dim xR As Range, Xi As Integer, i As Integer, ¹Ï¦â()
  3.     ¹Ï¦â = Array(4, 6, 8, 10)
  4.     ActiveSheet.ChartObjects.Delete         '§R°£¥þ³¡¹Ïªí
  5.     Set xR = Range("F1")    '§Q¥ÎxRªº¦ì¸m ³]¤U¹Ïªíªº¦ì¸m
  6.         '¥[¤J·s¹Ïªí  ¶·«ü©w 1¥kÃä¦ì¸m, 2°ª«×¦ì¸m, 3¹ÏªíªºWidth, 4¹ÏªíªºHeight
  7.         With ChartObjects.Add(xR.Left, xR.Top, xR.Resize(, 10).Width, xR.Resize(10).Height).Chart
  8.             .ChartType = 51  ' xlLineMarkers    '§é½u¹Ï                             '¹Ïªí ¦¡¼Ë
  9.             With ActiveSheet.Range("A11").CurrentRegion
  10.                     Set xR = Union(.Columns(1), .Columns(3), .Columns(5))
  11.                     '¸ê®Æ ½d³òªº 1,3,5 Ä欰¹Ïªí¸ê®Æ  :²Ä1Äæ ¬°x¶bªº¼Æ­È
  12.             End With
  13.             .SetSourceData Source:=xR, PlotBy:=xlColumns
  14.             '¹Ïªí¸ê®Æ¨Ó·½ : xR  ¸ê®Æ¦¡¼Ë: Äæ
  15.                           
  16.              .HasTitle = True                                              'Åã¥Ü ¹Ïªí¼ÐÃD
  17.              .ChartTitle.Characters.Text = ActiveSheet.Name                'HasTitle = False ·|¦³¿ù»~
  18.              .HasAxis(xlCategory, xlPrimary) = False                       '¤£Åã¥Ü X¶b®y¼Ð
  19.             
  20.             'HasLegend ¹Ï¨Ò
  21.              .HasLegend = False                                         ' ¨ú®ø Åã¥Ü ¹Ï¨Ò
  22.            '  .Legend.Position = xlTop                                   'Åã¥Ü ¹Ï¨Ò¦ì¸m
  23.            ' .Axes(xlCategory).TickLabels.NumberFormatLocal = "m/d;@"    ' Axes(xlCategory) X®y¼Ð¶b
  24.            ' ** ¤W¤G¦¡ ¶·  Åã¥Ü¹Ï¨Ò ->  .HasLegend = True
  25.             
  26.             '.SeriesCollection(1).AxisGroup = 2                           '·s¼W Y®y¼Ð¶b °Æ®y¼Ð¶b
  27.           '  .SeriesCollection(3)).Delete                 '§R°£²Ä3¼Æ¦C¸ê®Æ
  28.             With .Axes(xlValue)          'y¶b®æ½u
  29.                 .HasMajorGridlines = 0   '¨ú®ø ¥D®æ½u
  30.                 .HasMinorGridlines = 0   '¨ú®ø °Æ®æ½u
  31.             End With
  32.             '¥H¤U¤@¨Çµ{¦¡½X §A¥i¥Î¿ý»s±oª¾
  33.             With .ChartArea                                             '¹Ïªíªº¹Ïªí°Ï
  34.                 .Border.Weight = 1
  35.                 .Border.LineStyle = -1
  36.                 .Fill.OneColorGradient Style:=msoGradientHorizontal, Variant:=3, Degree:=0.231372549019608
  37.                 .Fill.Visible = True
  38.                 .Fill.ForeColor.SchemeColor = ¹Ï¦â(0)
  39.             End With
  40.             With .PlotArea                                              '¹Ïªíªº ø¹Ï°Ï
  41.                 .Fill.OneColorGradient Style:=msoGradientHorizontal, Variant:=1, _
  42.                 Degree:=0.231372549019608
  43.                 .Fill.Visible = True
  44.                 .Fill.ForeColor.SchemeColor = ¹Ï¦â(0)
  45.                 With .Border
  46.                     .ColorIndex = 16
  47.                     .Weight = xlThin
  48.                     .LineStyle = xlContinuous
  49.                 End With
  50.             End With
  51.             For i = 1 To .SeriesCollection.Count
  52.                 With .SeriesCollection(i)   '¼Æ¦C
  53.                   '  .XValues = ""           '<-¬°x¶bªº¼Æ­È   ¥i¦b¦¹¨ú®ø
  54.                     With .Border
  55.                         .ColorIndex = ¹Ï¦â(i)
  56.                         .Weight = xlMedium
  57.                         .LineStyle = xlContinuous
  58.                     End With
  59.                     '¥H¤UÄÝ©Ê ¥u¾A¦X §é½u¹Ï
  60.                    ' .MarkerBackgroundColorIndex = xlAutomatic
  61.                     '.MarkerForegroundColorIndex = xlAutomatic
  62.                     '.MarkerStyle = xlNone
  63.                     '.Smooth = False
  64.                     '.MarkerSize = 7
  65.                     '.Shadow = False
  66.                 End With
  67.             Next
  68.         End With
  69. End Sub
½Æ»s¥N½X

TOP

¦^´_ 3# c_c_lai
  1. Sub setRowColumn(sDraw As String)
  2.     Dim oShape As Shape
  3.     Dim xRow, yCol, cHeight, cWidth, inLeft, inTop, inWidth As Integer
  4.     Dim totalRows As Single
  5.     Dim chartname As String
  6.     'totalRows = Sheets("²Î­p¹Ïªí").Range("B" & Rows.Count).End(xlUp).Row     ' ¶Ç¦^ B Äæ©Ò¨Ï¥ÎÀx¦s®æ¤§³Ì«á¤@®æ¤§¦C¸¹
  7.     '¦p§@¥Î¤¤ª«¥ó ¤£¬O¤u§@ªí ·|¦³¿ù»~ ¦p¬O¹Ïªíµ¥
  8.     totalRows = Sheets("²Î­p¹Ïªí").Range("B" & Sheets("²Î­p¹Ïªí").Rows.Count).End(xlUp).Row     ' ¶Ç¦^ B Äæ©Ò¨Ï¥ÎÀx¦s®æ¤§³Ì«á¤@®æ¤§¦C¸¹
  9.     Sheets(sDraw).Select
  10.     For Each oShape In ActiveSheet.Shapes
  11.         If oShape.Type = 3 Then
  12.             ActiveSheet.ChartObjects(oShape.Name).Activate                      ' ·Æ¹«ÂI¦b "¹Ïªí #" ¤W (¨Ò¦p¡G¥D¤O¬É¤J)¡C
  13.             '*************
  14.             '§A¤W¦¡µ{¦¡½X  ¨Ï±o§@¥Î¤¤ª«¥óÅܬ° ¹Ïªí «á­±ªºµ{¦¡¦p¦³ ¨úªº¤u§@ªíªº¦ì§} ¬Ò¶·¥[¤W  Sheets((¤u§@ªí).[A1] µ¥...
  15.             ActiveChart.SetSourceData Source:=Range("²Î­p¹Ïªí!$B$1:²Î­p¹Ïªí!$B$" & totalRows & ", ²Î­p¹Ïªí!$F$1:²Î­p¹Ïªí!$F$" & totalRows & _
  16.             ", ²Î­p¹Ïªí!$I$1:²Î­p¹Ïªí!$J$" & totalRows & ", ²Î­p¹Ïªí!$S$1" & totalRows)  ' ¹Ï¥Ü·|¤À§OÅã¥Ü¥X ¦¨¥æ»ù¡B¥D¤O¬É¤J¡B¥H¤Î´²¤á¤è¦V¡C
  17.             
  18.             'ActiveChart.SeriesCollection.Add Source:=Range("²Î­p¹Ïªí!$S$1"& totalRows)
  19.             'ActiveChart.SeriesCollection(4).Name = "=²Î­p¹Ïªí!$S$1"  '*** ¦ì§}­n¥ÎR1C1 ¤è¦¡ªí¥Ü
  20.             'ActiveChart.SeriesCollection(4).Name = "=" & [²Î­p¹Ïªí!$S$1].Address(, , xlR1C1, 1)
  21.             'ActiveChart.SeriesCollection(4).ChartType = xlColumnClustered          ' °ïÅ|ª½±ø¹Ï
  22.             xRow = 2
  23.             yCol = 1
  24.             cHeight = 488
  25.             cWidth = 450
  26.             inLeft = 30
  27.             inTop = 30
  28.             inWidth = 378
  29.             chartname = Trim(Replace(ActiveChart.Name, ActiveSheet.Name, ""))
  30.             'ActiveChart.ChartArea.Height = cHeight                           ' ±N­ì¥»³]©w¤§°ª«×½Õ¦Ü¾A«×¦ì¸m
  31.             'ActiveChart.ChartArea.Width = cWidth
  32.             'ActiveSheet.Shapes(chartname).Left = Cells(xRow, yCol).Left     ' ³]©w¦¹¹Ïªí¹ê»ÚÂ\©ñªº X¡BY ®y¼Ð¦ì¸m¡C
  33.             'ActiveSheet.Shapes(chartname).Top = Cells(xRow, yCol).Top
  34.             With ActiveChart.Parent
  35.                 .Width = cWidth                                       'ChartArea.-§ï¦¨ ¤÷¼h  Parent
  36.                 .Height = cHeight
  37.                 .Left = ActiveSheet.Cells(xRow, yCol).Left
  38.                 .Top = ActiveSheet.Cells(xRow, yCol).Top
  39.                 With .Chart.PlotArea                  ' ¹ê»Úø¹Ï°Ï¶ôªº½d³ò³]©w
  40.                   Debug.Print .InsideLeft             '  ¶Ç¦^: ø¹Ï°Ï¶ô½d³ò³]©w
  41.                   Debug.Print .InsideTop              'Debug.Print: ¦L¦C¦b->   ¦bÀ˵ø«ü¥O->§Y®É¹Bºâµøµ¡
  42.                   Debug.Print .InsideWidth
  43.                     .Left = inLeft                    '  ³]©w: ø¹Ï°Ï¶ô½d³ò
  44.                     .Top = inTop
  45.                     .Width = inWidth
  46.                 End With
  47.             End With
  48.         End If
  49.     Next
  50. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤@¥y·Å·xªº¸Ü¡A´N¹³©¹§O¤H¨­¤WÅx­»¤ô¡A¦Û¤v·|ªg¨ì¨â¤Tºw¡C
ªð¦^¦Cªí ¤W¤@¥DÃD