Please advise on the following:
I have a code that should refresh formulas in my workbook and then copy the results as values to the other sheet. The problem is that the code flies right through everything and copies data even before the refresh is completed (refresh takes approx. 10-15 seconds).
I have used the below (and its varieties) but it didn't do anything to slow it down:
Application.Wait (Now + TimeValue("0:00:15"))
Do I have to do a loop that would check the cell content and execute "copy" part once it identifies the cell is updated?
Sub Excel_VBA_Timer_Event1()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim V As Workbook: Dim x, y, z As Worksheet
Set V = ThisWorkbook: Set x = V.Sheets(1): Set y = V.Sheets(2): Set z = V.Sheets(3)
z.Columns("A:O").EntireColumn.Delete
Aplication.Run "RefreshAllWorkbooks"
'WAIT HERE for approx 15 seonds
'At the moment the code flies through till the end before Bloomberg formulas are refreshed
y.Columns("C:M").Copy
z.Range("A1").PasteSpecial (xlPasteValues): z.Range("A1").PasteSpecial (xlPasteFormats)
z.Activate: z.Cells(1, 1).Select
Application.CutCopyMode = False
MsgBox "Done"
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub