Sorry I’m new to macros.
Essentially what I need done is if a cells value is “ERROR” then refresh the cell to check for new data. I have the msgbox there to make sure I have everything up to that working. I’m not attached to this code if theres a better method.
Sub Cell_Looping1() 'c = cell For Each c In Selection 'Do this If c.Value = "ERROR" Then MsgBox "Cell " & c.Address & " needs to be refreshed" End If Next c End Sub
To add some context. “ERROR” happens when I pull too much data from the API. I generally resolve this by selecting the cell in error pressing F2 then Enter. This macro will make life so much easier.
This will replicate the action of pressing
F2 to edit/refresh/recalculate the cell without changing it.
Sub YourMacro() Dim c As Range For Each c In Selection.Cells If c.Value = "ERROR" Then c.Formula = c.Formula Next c End Sub