Hi there,
I find myself having to use Excel VBA after quite a long time away from it I was once using Excel VBA 'all the time', but that was quite a long time ago! - I therefore anticipate probably having to ask further questions!), and I presume I am doing/overlooking something silly.
I am using the following (simplified) code to change the value in cell F9 when the contents of any of the cells in the worksheet are manually changed, on the basis of some fairly complicated logic regarding the values of other cells:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
if [xxxx] then
Worksheets(4).Range("F9").Value = "pppp
elseif [yyyy] THEN
Worksheets(4).Range("F9").Value = "qqqq
else
Worksheets(4).Range("F9").Value = "rrrr
end if
Application.EnableEvents = True
End Sub
I had to disable and then enable events to prevent looping. The routine does as intended, in the sense of putting the correct value into cell F9, but Excel then totally 'freezes' and I can only close it by using Task Manager.
Am I missing something obvious?
Kind Regards, John
Bookmarks