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

danbates

Active Member
Joined
Oct 8, 2017
Messages
261
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
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,690
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,089,678
Messages
5,409,689
Members
403,276
Latest member
Oscar007

This Week's Hot Topics

Top