Hello, I found some code on a site that can function similar to the codeline: Application.Wait (Now + TimeValue("0:00:01"))
The code is:
#If VBA7 Then
Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr) 'For 64-Bit versions of Excel
#Else
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 'For 32-Bit versions of Excel
#End If
Sub SleepDemo()
Sleep 500 'milliseconds (pause for 0.5 second)
'resume macro
End Sub
Currently, I have an event code that changes a shapes color if data is entered in a particular cell. Unfortunately though, it can only do 1 second intervals with the application.Wait codeline. The code I have doing this is as follows:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("J34")) Is Nothing Then Exit Sub
MsgBox "REMINDER: After filling out info for this row, click the Archive and Reset Sheet button", vbOKOnly
Shapes("Archive_Reset").Fill.ForeColor.RGB = vbRed
Application.Wait (Now + TimeValue("0:00:01"))
Shapes("Archive_Reset").Fill.ForeColor.RGB = vbBlue
Application.Wait (Now + TimeValue("0:00:01"))
End Sub
Is it possible to somehow use the sleep 500 in my event code to do the half second intervals to replace the applicaton.wait aspect? How might this be done if so?
Thank you for your time!
Bookmarks