1、为ComboBox等控件赋值:
示例:
ComboBox1.List = Array("a", "b", "c", "d", "e")
ListBox1.List = Array("a", "b", "c", "d", "e")
2、为工作表区域赋值:
示例:
'用数组为区域赋值
Dim Alist As Variant
Alist = Array("a", "b", "c", "d", "e")
[A1].Resize(, 3).Value = Alist
[A2].Resize(3, 1).Value = _
Application.Transpose(Alist)
3、用数组获取区域值:
示例:
Dim a()
a = Range("A1:B4").Value
Range("C1:D4").Value = a
4、成组选择工作表:
示例:
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
5、用数组定义图表系列:
示例:
Dim aNewSeries As Series
Dim SalesArray As Variant
Dim MonthArray As Variant
MonthArray = Array("Jan", "Feb", "Mar")
Set aNewSeries = .SeriesCollection.NewSeries
aNewSeries.Values = SalesArray
aNewSeries.XValues = MonthArray
[此贴子已经被作者于2005-8-10 10:02:27编辑过] |