Visual Basic timeing

B4L4KS

Board Regular
Joined
Mar 7, 2011
Messages
69
hi

is there a way of accessing a sheet but for a certain time, so when i click a button and everything happens and goes onto a sheet for say 5 seconds and then goes off of it

thanks

kristian
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
What does clicking the button do and what is the "everything" which is happening?

After it happens, you could wait five seconds and then undo what has happened, if you know at that point exactly what that "everything" is.

Alternatively you could save the sheet before "everything happens", then after it has happened, wait five seconds and reload the sheet from the saved version.
 
Upvote 0
hi

when the macro button is clicked it prints off a sheet and then sorts out product orders, then it goes onto a sheet and there i want it to wait open for five seconds before it returns to its original sheet.

order form starts off on and prints off on receipt but doesnt show except for the print icon, and sorts out the products without showing, then moves onto a page to show data, this is where i want it to stay for 5 seconds

thanks

kristian
 
Upvote 0
Ah sorry, I misunderstood - I thought you were wanting to undo some changes somehow. You just want the macro to pause for a few seconds before continuing.

This will pause for five seconds and then continue:-
Code:
application.wait now() + timevalue("00:00:05")

Just insert that at any point in the code where you want it to pause.

If that doesn't display the worksheet when it pauses, you may need to do this:-
Code:
with application
  .screenupdating = true
  .wait now() + timevalue("00:00:05")
  .screenupdating = false
end with
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,584
Messages
6,179,687
Members
452,938
Latest member
babeneker

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