請教一個 EXCEL VBA 問題..
我以手工"錄製"巨集如下:
Rows("3:3").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Rows("6:6").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Rows("9:9").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Rows("12:12").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
現在, 我想用 for_next迴圈,一直做到Rows("120:120").Select為止,
請問何解? thanks
本帖最後由 googleandy 於 17-6-20 12:27 編輯
Dim i As Integer
For i = 3 To 120 Step 3
Rows("""" & Trim(Str(i)) & ":" & Trim(Str(i)) & """").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Next i
以上的嘗試, 文法沒錯,可編譯, 但無法執行.
Rows(Trim(Str(i)) & ":" & Trim(Str(i))).Select
akmod 發表於 17-6-20 13:04
Rows(Trim(Str(i)) & ":" & Trim(Str(i))).Select
謝謝A大.{:5_260:}
頁:
[1]