返回列表 上一主題 發帖

[發問] 如何應用 VBA 將股票圖完整的呈現出來?

回復 6# c_c_lai
參考看看

圖表.rar (43.89 KB)

TOP

回復 8# c_c_lai
(1)   E 指的是 D1 往右到最後有資料的範圍 ,  [d1].End(xlToRight)  如工作表上按下 Ctrl+-> 右方向鍵

(2)  Rng(1).Columns(Application.Match(Ar(xi), Rng(1).Rows(1), 0)) 指的是甚麼?   Rng(1).Columns(找到的欄)
Application.Match(Ar(xi), Rng(1).Rows(1), 0)->  工作表Match函數 在 Rng(1).Rows(1)-> Rng(1)的第一列  尋找 Ar(xi)

(3)   .ChartType = xlColumnClustered    有些屬性 並不是所有的圖形  都可以用的

(4) 當圖表不存在時,程式 (制定資料區) 執行到 .ChartObjects.Delete 會產生 "執行階段錯誤 '1004'"
2003版 不會有 是你的版本較嚴謹

(5) 捲軸 可縮短資料數, 直接打上數值也可以縮短資料數.

TOP

回復 12# c_c_lai
在圖表中 數列數大於2才可以指定副座標軸( Y座標)
AxisGroup 屬性XlAxisGroup 可以是這些 XlAxisGroup 常數之一。
xlPrimary             1  ( X座標 )
xlSecondary        2  ( Y座標)
  1. For Each E In ActiveSheet.Shapes
  2.                 If InStr(E.Name, "Option Button") Then
  3.                     If E.OLEFormat.Object.Value = 1 Then 副座標 = E.TopLeftCell(1, 0)
  4.                 End If
  5.             Next
  6.          ' 以上程式碼的目的在尋找 指定為 副座標 數列 的名稱
  7.             For xi = 1 To .SeriesCollection.Count
  8.                 With .SeriesCollection(xi)
  9.                    ' If .Name = "成交量" And .Parent.SeriesCollection.Count > 1 Then .AxisGroup = 2
  10.                     If .Name = 副座標 And .Parent.SeriesCollection.Count > 1 Then .AxisGroup = 2
  11.                     .Border.ColorIndex = Int(55 * Rnd) + 1  '亂數產生數列底色
  12.                     .Border.Weight = xlThin
  13.                     .Border.LineStyle = xlContinuous
  14.                     .MarkerStyle = xlNone
  15.                     .MarkerBackgroundColorIndex = xlNone
  16.                     .MarkerForegroundColorIndex = xlNone
  17.                     .MarkerStyle = xlNone
  18.                     .Smooth = False
  19.                     .MarkerSize = 2
  20.                     .Shadow = False
  21.                 End With
  22.             Next
複製代碼

TOP

        靜思自在 : 謊言像一朵盛開的鮮花,外表美麗,生命短暫。
返回列表 上一主題