simple yet cannot work it

bongobus

New Member
Joined
Jul 11, 2017
Messages
28
hi the following works other than the red code doesn't wait until reached zero, I want it to wait until timer finished, can you help please


Sub Macro6()
'
Range("E17:L22").Select
Selection.ClearContents
Range("c15").Select

Application.Wait (Now + TimeValue("0:00:05"))
Sheets("Sheet4").Select
Range("n1").Select
ActiveCell.FormulaR1C1 = "12:00:30 AM"
starttimer
Sheets("Sheet5").Select
Range("L3:S8").Select
Selection.Copy
Sheets("Sheet4").Select
Range("E17").Select
ActiveSheet.Paste
Range("c15").Select<strike></strike>





End Sub



____________________________________________________________________________
Sub starttimer()
Application.OnTime Now + TimeValue("00:00:01"), "nexttick"
End Sub


_____________________________________________________________________________

Sub nexttick()
If Sheet4.Range("n1") = 0 Then Exit Sub
Sheet4.Range("n1").Value = Sheet4.Range("n1").Value - TimeValue("00:00:01")
starttimer

End Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
You could replace your starttimer and nexttick macros with this loop:

Code:
Do Until Sheet4.Range("N1") = 0
    Application.Wait (Now + TimeValue("0:00:01"))
    Sheet4.Range("N1").Value = Sheet4.Range("N1").Value - TimeValue("00:00:01")
Loop

Some of your ranges need qualifying too. They should really have a sheet associated with them.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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