I want to refresh my workbook and then run a check on a cell and if value > 0 display a message, the code i have seems right and logical but the refresh is done after the check value, i have tried spliting these into seperate macros and calling them in sequence but the refresh still runs after the check. not sure if it is worth noting that the refresh involves refreshing data connections to an SQL DB.
this is the two macros i have at the moment :
Sub RefreshMacro()
ActiveWorkbook.RefreshAll
Sheets("Execution").Select
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
Sheets("Traffic Lights").Select
ActiveWorkbook.RefreshAll
End Sub
Sub ErrorMessage()
If Sheets("Traffic Lights").Range("G2").Value > "0" Then
MsgBox "Error with data!" & vbCr &
"Please Note There is an issue with the data" & vbCr &
"See Traffic Lights for more details!", vbOKOnly + vbExclamation,
"Red Traffic Lights"
End If
End Sub