disappear undo

MILTINO

New Member
Joined
Jan 30, 2022
Messages
14
Office Version
  1. 2016
Platform
  1. Windows
Greetings I have a very large book and with macros they work well, the problem I have is that in a sheet when I delete data from cells in the first instance the Undo is activated the arrow but then when I select any other cell the UNDO is deactivated
I allow myself to send in the event that may be causing this problem

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim LimiteSuperior As Long, LimiteIzquierdo As Long
If Not Application.Intersect(Target, Range("AQ13:AQ25")) Is Nothing Then
Sheets("Hoja3").Visible = True
Sheets("PRESUPUESTOS").Shapes("IMAGENPU").Visible = True
Let LimiteSuperior = Target.Offset(-12, 0).Top
Let LimiteIzquierdo = Range("E1").Left
With ActiveSheet.Shapes("IMAGENPU")
.Top = LimiteSuperior
.Left = LimiteIzquierdo
End With
Else
If Not Application.Intersect(Target, Range("AQ26:AQ282")) Is Nothing Then
Sheets("Hoja3").Visible = True
Sheets("PRESUPUESTOS").Shapes("IMAGENPU").Visible = True
Let LimiteSuperior = Target.Offset(-25, 0).Top
Let LimiteIzquierdo = Range("E1").Left
With ActiveSheet.Shapes("IMAGENPU")
.Top = LimiteSuperior
.Left = LimiteIzquierdo
End With
Else
Sheets("PRESUPUESTOS").Shapes("IMAGENPU").Visible = False
Sheets("Hoja3").Visible = False
End If
End If
End Sub
 
Last edited by a moderator:

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
After a Macro is executed, the "Undo" steps prior to the Macro are unavailable.
 
Upvote 0
I delete data manually independent of the macro,
without the macro it works I delete data manually and I can recover it with Undo
Thank you
 
Upvote 0
I delete data manually independent of the macro,
without the macro that corresponds to the event Private Sub Worksheet_SelectionChange(ByVal Target As Range) it works fine, since I delete data manually and I can recover it with Undo
Thank you
 
Last edited by a moderator:
Upvote 0
As @SpillerBD has stated running a macro that interacts with the worksheet clears the Undo stack, there is nothing that you can do about that.
If you were trying to just undo the last action you had carried out in the macro then you could use Application.Undo, but it won't help in your case.
 
Upvote 0
Greetings, what happens is that I manually delete data and normally the undo is activated
Everything got complicated when I enter a Private Sub Worksheet_SelectionChange event which I don't use to delete data, I keep manually deleting.
But when I do or delete data undo disappears


Ícono de validado por la comunidad
 
Upvote 0
But when I do or delete data undo disappears
Yes as we have already stated when VBA interacts with a sheet the Undo stack is cleared, there is NOTHING you can do about this behaviour.
It doesn't matter what action the VBA is carrying out, the Undo stack is cleared.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,480
Messages
6,125,050
Members
449,206
Latest member
Healthydogs

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top