I have a Worksheet_Change
event, currently at the Sheet Module Level
. The problem is that I want to be able to clear this sheet at times. However, when I clear my sheet I get an overflow:
Private Sub Worksheet_Change(ByVal Target As Range)
'This is the line causing the problem because clearing the whole sheet causes the count to be massive
If Target.Count = 1 Then
If Target = Range("A4") Then
If InStr(LCase(Target.Value), "loaded") <> 0 Then
Range("A5").FormulaArray = "=My_Function(R[-1]C)"
End If
End If
End If
End Sub
I am trying to achieve the following:
I press a button and the sheet is cleared (clears existing array formula data), I then paste in a formula to the sheet and call the formula. The formula returns data back to the excel cache and changes the cell containing this formula (A4) to a string saying "loaded". When I detect a cell change with value "loaded" I then do the equivalent on Ctrl + Shift + Enter on an array formula function below, to display the data.