2009年2月28日星期六

excel vba - array 陣列

Sub 資料搬移()

Dim myx, myi



arydataSec1 = Array("g5", "k5", "k6", "c6", "c5", "g7") ' 開課基本資料
arydataSec2 = Array("b12", "b13", "b14", "b15", "b16") ' 滿意度1
arydataSec3 = Array("c12", "c13", "c14", "c15", "c16") ' 滿意度2
arydataSec4 = Array("d12", "d13", "d14", "d15", "d16") ' 滿意度3
arydataSec5 = Array("e12", "e13", "e14", "e15", "e16") ' 滿意度4
arydataSec6 = Array("f12", "f13", "f14", "f15", "f16") ' 滿意度5
arydataSec7 = Array("g12", "g13", "g14", "g15", "g16") ' 滿意度6
arydataSec8 = Array("h12", "h13", "h14", "h15", "h16") ' 滿意度7
arydataSec9 = Array("i12", "i13", "i14", "i15", "i16") ' 滿意度8
arydataSeca = Array("k12", "k13", "k14", "k15", "k16") ' 滿意度9
arydataSecb = Array("b21", "b22", "b23", "b24", "b25", "b26", "b27", "b28", "b29", "b30", "b31", "b32", "b33", "b34", "b35", "b36", "b37", "b38", "b39", "b40", "b41", "b42", "b43", "b44", "b45", "b46", "b47", "b48", "b49", "b50") ' 居住統計
arydataSecc = Array("f21", "f22", "f23") ' 性別
arydataSecd = Array("f25", "f26", "f27", "f28", "f29", "f30", "f31", "f32", "f33", "f34", "f35", "f36", "f37", "f38", "f39") ' 出生統計
arydataSece = Array("f41", "f42", "f43", "f44", "f45", "f46") ' 族群統計
arydataSecf = Array("f48", "f49", "f50") ' 成績統計
arydataSecg = Array("k21", "k22", "k23", "k24", "k25", "k26", "k27", "k28", "k29") ' 學歷統計
arydataSech = Array("k33", "k34", "k35", "k36", "k37", "k38", "k39", "k40", "k41", "k42") ' 職業統計
arydataSeci = Array("k45", "k46", "k47", "k48", "k49", "k50") ' 課程統計



For myi = 0 To 5
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSec1(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 1).Value = myx
Next myi

For myi = 0 To 4
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSec2(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 7).Value = myx
Next myi

For myi = 0 To 4
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSec3(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 12).Value = myx
Next myi


For myi = 0 To 4
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSec4(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 17).Value = myx
Next myi


For myi = 0 To 4
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSec5(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 22).Value = myx
Next myi

For myi = 0 To 4
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSec6(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 27).Value = myx
Next myi


For myi = 0 To 4
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSec7(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 32).Value = myx
Next myi


For myi = 0 To 4
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSec8(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 37).Value = myx
Next myi

For myi = 0 To 4
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSec9(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 42).Value = myx
Next myi


For myi = 0 To 4
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSeca(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 47).Value = myx
Next myi

For myi = 0 To 29
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSecb(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 52).Value = myx
Next myi

For myi = 0 To 2
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSecc(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 82).Value = myx
Next myi


For myi = 0 To 14
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSecd(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 85).Value = myx
Next myi


For myi = 0 To 5
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSece(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 100).Value = myx
Next myi


For myi = 0 To 2
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSecf(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 106).Value = myx
Next myi


For myi = 0 To 8
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSecg(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 109).Value = myx
Next myi

For myi = 0 To 9
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSech(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 118).Value = myx
Next myi


For myi = 0 To 5
Windows("數位落差結案檔.xls").Activate
myx = Sheets("滿意度調查統計表").Range(arydataSeci(myi)).Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, myi + 128).Value = myx
Next myi


Windows("數位落差結案檔.xls").Activate
myx = Sheets("B結訓學員名冊").Range("d56").Value
Windows("問卷統計.xls").Activate
ActiveCell.Offset(0, 133).Value = myx


ActiveWorkbook.Save
ActiveWindow.Close
End Sub

1 评论:

lkjoijl 说...

熊貓情色,美女遊戲區,成人dvd,qq聊天室,aaa片免費看,手槍美女賞圖,家庭教師影片,洪爺情色,麗的色情遊戲,爽翻天成人情趣,qq聊天室,影音日誌,情色典獄長,520聊天室,080 中部人聊天室,成人文章,a片短片,成人貼圖區,免費av,杜蕾斯免費a片,柔情聊天網,豆豆聊天室,性感影片,台灣kiss情色,台灣自拍,都都成人站,小魔女自拍天堂,

aaaa片,男男貼圖區,交友私樂園,麗的線上小遊戲,卡通a片,免費情色小說,性感影片,情色聊天室,成人貼圖區,免費av,xxx383美女寫真,正妹強力版,無碼女優,女同聊天室,性愛聊天室,飯島愛,美眉,臺灣情色網,100one百萬成人貼電影,正妹強力牆,bobo寫真女郎影片,av女優,383成人,情人視訊,

3d美女圖,小莉影音像館,情色武俠小說,色美眉部落格,台灣無限貼圖區,完美女人影音網,辣美眉173show影片,自拍a片,kiss情色,熊貓貼圖區列表,自拍貼圖,s383情色大網咖,85cc免費影城,a片圖片,寫真女郎攝影網,豆豆聊天,嘟嘟貼圖,美女自拍,自拍a片,hcg 貼圖區,卡通成人網,聊天室avooo,自拍偷拍,情色文學小說,

情色交友,ut男同志聊天室,成人電影,正妹星球,無碼光碟,做愛自拍,爽翻天成人用品,歐美模特兒寫真,999成人性站,免費遊戲,成人動畫,aaaaa片俱樂部,免費線上成人影片,丁字褲美女寫真,老婆自拍,漂亮寶貝,聊天室,情色小遊戲,080 中部人聊天室,裸體寫真,線上看a片,18禁地少女遊戲,後宮情色網,日本女優,月宮貼圖區,

 
妹咕數位學園歡迎網友們來信指教 妹咕信箱