- 帖子
- 4901
- 主題
- 44
- 精華
- 24
- 積分
- 4916
- 點名
- 104
- 作業系統
- Windows 7
- 軟體版本
- Office 20xx
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-4-30
- 最後登錄
- 2025-4-30
               
|
3#
發表於 2011-1-17 21:01
| 只看該作者
回復 1# j1221
先改變資料數列再設定圖表類型- Sub Macro1()
- '
- ' Macro1 Macro
- ' Shih-Hao 在 2011/1/16 錄製的巨集
- '
- '
- Charts.Add
- 'ActiveChart.ChartType = xlStockOHLC '取消這行
- ActiveChart.SetSourceData Source:=Sheets("76C").Range("A1:N22"), PlotBy:= _
- xlColumns
- ActiveChart.SeriesCollection(5).Delete
- ActiveChart.SeriesCollection(5).Delete
- ActiveChart.SeriesCollection(5).Delete
- ActiveChart.SeriesCollection(5).Delete
- ActiveChart.SeriesCollection(5).Delete
- ActiveChart.SeriesCollection(1).XValues = "='76C'!R2C1:R22C1"
- ActiveChart.SeriesCollection(2).XValues = "='76C'!R2C1:R22C1"
- ActiveChart.SeriesCollection(3).XValues = "='76C'!R2C1:R22C1"
- ActiveChart.SeriesCollection(4).XValues = "='76C'!R2C1:R22C1"
- ActiveChart.Location Where:=xlLocationAsObject, Name:="76C"
- With ActiveChart
- .HasTitle = False
- .Axes(xlCategory, xlPrimary).HasTitle = False
- .Axes(xlValue, xlPrimary).HasTitle = False
- .ChartType = xlStockOHLC '這裡才改變類型
- End With
- ActiveChart.HasLegend = False
- Windows("test1.xls").SmallScroll Down:=7
- ActiveSheet.Shapes(1).IncrementLeft -168.75
- ActiveSheet.Shapes(1).IncrementTop 269.25
- Windows("test1.xls").SmallScroll Down:=6
- ActiveSheet.Shapes(1).ScaleWidth 1.53, msoFalse, msoScaleFromTopLeft
- ActiveSheet.Shapes(1).ScaleHeight 1.36, msoFalse, msoScaleFromTopLeft
- ActiveChart.PlotArea.Select
- With Selection.Border
- .ColorIndex = 16
- .Weight = xlThin
- .LineStyle = xlContinuous
- End With
- With Selection.Interior
- .ColorIndex = 2
- .PatternColorIndex = 1
- .Pattern = xlSolid
- End With
- With Selection.Border
- .ColorIndex = 16
- .Weight = xlThin
- .LineStyle = xlContinuous
- End With
- With Selection.Interior
- .ColorIndex = 40
- .PatternColorIndex = 1
- .Pattern = xlSolid
- End With
- ActiveChart.Axes(xlCategory).Select
- Selection.TickLabels.NumberFormatLocal = "yyyy-mm-dd"
- End Sub
複製代碼 |
|