I got a simple code that do if value if lass then X wait one hour else continue the loop-basically the code need to run for a hole day.
the thing is that when the code is in the wait line i cant use the excel at all. there is a way to solve this issue ? Im adding part of the code
For i = 1 To 3
Set OutMail = OutApp.createitem(0)
LastRefHour = Cells(2, 1).Value
HourNow = Hour(Now())
Set rng = Sheets("Sheet1").Range("D2:G9").SpecialCells(xlCellTypeVisible)
If (LastRefHour < HourNow) Then
ActiveWorkbook.Connections("Monitor-Test").Refresh
Application.CalculateUntilAsyncQueriesDone
If Not Application.CalculationState = xlDone Then
DoEvents
End If
Cells(1, 1).Copy
Cells(2, 1).PasteSpecial xlPasteValues
Else:
Application.Wait (Now + TimeValue("00:59:00"))
End If