one by one as if do it manually

Hudson Andrew

New Member
Joined
Sep 28, 2016
Messages
31
Hi all ,

I have one simple question in fact it's stupid too.


i have loop code like below . all i wanted is the code is working fine but i wanted the code to run slowly as if we do it using F8 . like as if we doing it manually one by one i tried all the steps but could not figured it out hence i am looking for help.
Code:
Sub looping()

Dim x As Integer


x = 1


Range("A1").Select






Do Until ActiveCell.Value = 10


ActiveCell.Offset(1, 0).Select


ActiveCell.Value = x


x = x + 1
Loop




End Sub
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
You won't be able to do any editing on the sheet, but this will stop the code so you can see what it did, then continue by clicking OK.

Code:
Sub looping()
Dim x As Integer
x = 1
Range("A1").Select
Do Until ActiveCell.Value = 10
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = x
x = x + 1
MsgBox "Click OK when ready to continue"
Loop

Or if you don't want the message box

Code:
Sub looping2()
Dim x As Integer
x = 1
Range("A1").Select
Do Until ActiveCell.Value = 10
    ActiveCell.Offset(1, 0).Select
    ActiveCell.Value = x
    x = x + 1
    d = Timer + 1.5
         Do While Timer < d
              Do Events
         Loop
Loop
 
Last edited:
Upvote 0
Hello mate , This is really cool stuff.
another advice from you , from the below code how do i come to next column and then go up with the reverse order ?.

can that be possible ?.

Code:
Sub looping2()Dim x As Integer
x = 1
Range("A1").Select
Do Until ActiveCell.Value = 10
    ActiveCell.Offset(1, 0).Select
    ActiveCell.Value = x
    
'    Do Until ActiveCell.Value = 10
'    ActiveCell.Offset(0, 1).Select
'    ActiveCell.Offset(-1, 0).Select
'    ActiveCell.Value = x
'    x = x + 1
    d = Timer + 1.5
         Do While Timer < d
              DoEvents
         Loop


Loop
End Sub
 
Upvote 0
Code:
Sub looping2()
Dim x As Integer, d As Double
x = 1
Range("A1").Select
Do Until ActiveCell.Value = 10
    ActiveCell.Offset(1, 0).Select
    ActiveCell.Value = x
    x = x + 1
    d = Timer + 1.5
         Do While Timer < d
              DoEvents
         Loop
Loop
x = 0
ActiveCell.Offset(, 1).Select
Do
    x = x + 1
    ActiveCell = x
    ActiveCell.Offset(-1).Select
    d = Timer + 1.5
        Do While Timer < d
            DoEvents
        Loop
Loop Until x = 10
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top