ホーム :


繰り返し処理

前へ 次へ

参考URL
http://www.eurus.dti.ne.jp/yoneyama/Excel/vba/vba_for_next.html

@
if 条件式 then
処理
end if

A
if 条件式 then
処理1
else
処理2
end if

B
if 条件式 then
処理1
elseif 条件式2 then
処理2
else
処理x
end if


C
Select Case Range("a1")
case 10
処理1
case >11
処理2
case 10 to 20 ' 10以上20以下
処理3
end select


D
for i=1 to 20
処理
next


E
for i=1 to 100 step 2
処理
next

F
Do While 条件式
処理
Loop

G
Do Untile 条件式
処理
Loop

H
Do
処理
Loop While

I
Do
処理
Loop Until 条件式


J
For Each 変数 In コレクション
処理
next

[例]
dim シート as Worksheet
dim i as Integer
i=1
For Each シート In worksheets
シート.name=Range("A" & i).value
i=i+1
next






前へ 次へ
Excel for VBA Memo Ver1.7 に戻る