こんにちは、ツリーの次のコードのどれが VBA でより効率的かという質問があります
オプション1:
While fin
if activecell.value = "Comp"
' do something
' I use some many time the value of the activecell or the line
' im actually
end if
activecell.offset(1,0).activate
loop
オプション 2:
dim i as long
i=0
While fin
if activecell.offset(i,0).value = "Comp"
' do something
' I use some many time the value of the activecell or the line
' im actually
end if
i = i + 1
loop
オプション 3: 「実際の行を何回も使用するため、わかりません」その値を変数に取り込んだ方がよい場合
dim i as long
dim x as string
i=0
While fin
x = activecell.offset(i,0)
if x = "Comp"
' do something
' I use some many time the value of the activecell or
'the line im actually
end if
i = i + 1
loop
よろしくお願いします。
PD FOR または私が持っているすべてのコード
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
ActiveSheet.DisplayPageBreaks = False
Application.DisplayAlerts = False