1
我想在Excel中繪製線條圖。Excel中的變量範圍VBA
我有X軸作爲一個常量範圍,但我試圖使Y軸變量範圍。我的數據是B2-F2,B3-F3,B4-F4,B5-F5,B6-F6,B7-F7。我想把它們中的每一個都繪製成Y軸和恆定的X軸範圍,但無法弄清楚如何讓Y軸數據變化。
我用B2-F2作爲Y軸得到6張圖。
這是我到目前爲止有:
Dim rowno As Integer
Dim colno As Range
Dim time As Range
Dim pressure As Range
Dim Startrow As Integer
Dim Lastrow As Integer
Startrow = 2
Lastrow = 7
Set time = Range("B1:F1")
' THIS LINE HERE IS THE LINE IM STRUGGLING WITH
Set pressure = "B"&Startrow&":"&"F"&Lastrow
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLine
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = time
ActiveChart.SeriesCollection(1).Values = pressure
令人驚歎!謝謝! :) – Fiona 2015-03-13 17:22:14
任何想法如何移動圖?我有這個:ActiveChart.ChartArea.Top = rowheight * rowno - 270 ActiveChart.ChartArea.Height = rowheight ActiveChart.ChartArea.Width = 3 * rowheight ...但這意味着所有6個圖移動到相同的位置,我只需要知道如何分開移動圖表?謝謝! :) – Fiona 2015-03-13 17:23:27