Hi, this is urgent. how do i prevent the sheets from changing whenever the codes below runs? the code below will run every 5 seconds. but whenever it runs, it will go to EmailSheetAuto. i had tried not to select the sheet at the beginning but it does not work. Please help. I am stuck here for hours already.
I would appreciate your help very much.
I would appreciate your help very much.
Code:
Dim TimeToRun
Sub ScheduleCopyPriceOver()
Application.ScreenUpdating = False
TimeToRun = Now + TimeValue("00:00:05")
Application.OnTime TimeToRun, "CopyPriceOver"
End Sub
Sub CopyPriceOver()
Dim r As Range
Dim n As Long
Dim NextRow As Long
Application.ScreenUpdating = False
EmailSheetAuto = Sheets("Trading Platform").LoginName.Value
Sheets(EmailSheetAuto).Select
NextRow = Application.WorksheetFunction.CountA(Range("A:A")) + 1
Set r = Range(Cells(2, 1), Cells(NextRow, 1))
For n = 2 To r.Rows.Count
If Sheets("Trading Platform").LoginName.Value = Sheets("Login Details").Cells(2, 17) Then
If Sheets(EmailSheetAuto).Cells(n, 2).Value = "EUR/USD" Then
Sheets(EmailSheetAuto).Cells(n, 9) = "hi"
End If
End If
Next n
Call ScheduleCopyPriceOver
End Sub