Run Time error 28 - Out of stack space????

danbates

Board Regular
Joined
Oct 8, 2017
Messages
243
Hi,

Please can someone help me?

I have the following code which is triggering Run Time error 28 - Out of stack space.

This is the only code in my workbook as well.

How can I clear this error?

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Range("B2").Value <> "" Then
Range("R2").Value = Format(Date, "mm/dd/yyyy")
End If
End Sub
Thanks

Dan
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,512
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
If you change a cell in a Change event, you'll trigger the event again, hence the problem. You need to temporarily disable events:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Range("B2").Value <> "" Then
application.enableevents = false
Range("R2").Value = Format(Date, "mm/dd/yyyy")
application.enableevents = true
End If
End Sub
 
Last edited:

Forum statistics

Threads
1,084,989
Messages
5,381,041
Members
401,713
Latest member
BraydenMSB

Some videos you may like

This Week's Hot Topics

Top