I want make Excel Vba Code that can run after 5 to 10 seconds randomly. not fix time delay

Viewed 27

I want to make an Excel Vba time delay Code that can run my script after 5 to 10 seconds randomly. not fix time delay.

I use this below code but its fixed the time delay of 05 seconds

Application.Wait(Now + TimeValue("0:00:05"))

Can anybody help me out?

1 Answers

One option is to use WorksheetFunction.RandBetween:

Application.Wait Now + TimeSerial(0, 0, WorksheetFunction.RandBetween(5, 10))
Related