[算表] Sheets name 是變數
軟體:excel
版本:2010
各位版友大家好,我的活頁簿裡有十個Chart sheet,
Chart1~Chart10。
我想將他們換成變數 sLastDayPrice,
但在選sheet時
一直出現錯誤9 凍列索引超出範圍。
卡在下面這一行
Sheets("Chart" & i).Select
請問正確的格式應該怎麼寫呢?
我在yahoo查到的也是這樣寫,
這種格式問題會玩死人啊~_~
========
Dim sLastDayPrice(10) As String
Dim i As Integer
Sheets("工作表1").Select
'
'填值
'
For i = 1 To 10
sLastDayPrice(i) = CStr(Cells(2, 14 + i).Value)
Next i
'
'chart article、sheetname
'
For i = 1 To 10
Sheets("Chart" & i).Select
ActiveChart.ChartArea.Select
ActiveChart.Shapes.AddLabel(msoTextOrientationHorizontal, 216.2337795276, _
25.3246456693, 72, 72).Select
Selection.ShapeRange.TextFrame2.TextRange.Font.Size = 20
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = sLastDayPrice(i)
Sheets("Chart" & i).Name = sLastDayPrice(i)
Next i
--
錢會變薄,資產會縮水。
通通花光才有100%的享受,
這就是活在當下。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.131.214.203
→
05/12 23:29, , 1F
05/12 23:29, 1F
→
05/12 23:30, , 2F
05/12 23:30, 2F
Office 近期熱門文章
PTT數位生活區 即時熱門文章
11
38