| 
            
 Dim myFlag As Boolean 'フラグ
 
 Private Sub CommandButton1_Click()
 
 '最終行を取得
 LastRow = Range("B65536").End(xlUp).Row
 
 'フラグ
 myFlag = True
 
 
 i = ActiveCell.Row '開始位置は選択行
 
 
 
 Do While myFlag 'Trueの間、処理を続ける。
 
 Application.Wait Now() + TimeValue("00:00:02")  '時間をおく
 
 i = i + 1
 Cells(i, "B").Select
 
 
 '選択行をテキストボックスに表示
 TextBox1.Text = Cells(i, "C").Value
 TextBox2.Text = Cells(i, "D").Value
 
 
 Beep
 
 DoEvents
 
 
 '最終行では停止
 If i > LastRow - 1 Then
 
 MsgBox "最終行です。"
 
 Exit Do
 
 End If
 
 
 Loop
 
 
 End Sub
 
 
 |