What would I have to add to this VBA Code to keep Undo Button working after it runs

0 votes

I was looking for VBA code so that whenever I copy and paste the text into Excel from wherever the formatting will be preserved. To do it, I discovered two distinct codes:

Sub PasteWithDestinationFormatting()
ActiveCell.PasteSpecial (xlPasteAll)
End Sub

and

Sub PasteWithDestinationFormatting()
ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, DisplayAsIcon:=False
End Sub

The issue is that while both of them function, they both make it impossible to use the "Undo" button and the "Ctrl + Z" shortcut. I'm attempting to determine the cause of this and what I can do to remedy it.

Dec 16, 2022 in Others by Kithuzzz
• 28,900 points
47 views

1 answer to this question.

0 votes
VBA eliminates Excel's undo function. Though it would be complicated, you could use VBA to construct your own undo.
answered Dec 16, 2022 by narikkadan
• 53,520 points

Related Questions In Others

0 votes
1 answer
+1 vote
3 answers

What do I have to learn to become a software dev/engineer?

Hey, @Josh, Be Clear About Your End Goal. Software ...READ MORE

answered Jun 30, 2020 in Others by Gitika
• 65,910 points
630 views
0 votes
1 answer
0 votes
0 answers

Convert Rows to Columns with values in Excel using custom format

1 I having a Excel sheet with 1 ...READ MORE

Feb 17, 2022 in Others by Edureka
• 13,630 points
177 views
0 votes
1 answer

Remove formulas from all worksheets in Excel using VBA

Try this : Option Explicit Sub test1() ...READ MORE

answered Oct 3, 2022 in Others by narikkadan
• 53,520 points
295 views
0 votes
1 answer

Calculate monthly average from daily data without PivotTable

Assuming you have the months in column D enter ...READ MORE

answered Oct 3, 2022 in Others by narikkadan
• 53,520 points
200 views
0 votes
1 answer

Automate compound annual growth rate (CAGR) calculation

The following PowerPivot DAX formulas worked for ...READ MORE

answered Oct 7, 2022 in Others by narikkadan
• 53,520 points
281 views
0 votes
1 answer

How to programmatically code an 'undo' function in Excel-Vba?

Add the command button to the worksheet ...READ MORE

answered Nov 25, 2022 in Others by narikkadan
• 53,520 points
120 views
0 votes
1 answer

VBA code to select only a table. I am getting a Run-time error '1004'; Method 'Range' of object'_Global' failed

No copy/paste, just direct assignment use.Value Sub Final_Report() ...READ MORE

answered Jan 13 in Others by narikkadan
• 53,520 points
84 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP