Making Undo button active

  • Thread starter Thread starter Bhuktar S
  • Start date Start date
B

Bhuktar S

I have put the following in excel sheet code
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B2") > 20 Then
Range("B2").Interior.ColorIndex = 4
Else: Range("B2").Interior.ColorIndex = 2
End If
End Sub
If I edit any cell, I cannot undo, since the undo button on the men
bar becomes inactive.
How to overcome this
 
Save the file before editing any cell, that way if not like how edit changed
sheet, close and reopen


: Hi
: AFAIK no chance as this macro disabled the Undo function
:
: --
: Regards
: Frank Kabel
: Frankfurt, Germany
:
:
: > I have put the following in excel sheet code
: > Private Sub Worksheet_SelectionChange(ByVal Target As Range)
: > If Range("B2") > 20 Then
: > Range("B2").Interior.ColorIndex = 4
: > Else: Range("B2").Interior.ColorIndex = 2
: > End If
: > End Sub
: > If I edit any cell, I cannot undo, since the undo button on the menu
: > bar becomes inactive.
: > How to overcome this?
: >
: >
: > ---
: > Message posted
 
You may want to look at Format|Conditional formatting.

It looks like it would be simpler in this case.

(no macro, no problem with undo)
 
Dear Layla,
No, the edited cell does not undo but goes to previous action (in m
case I had another book opend & when I clicked the Undo on thi
workbook, it opend the earlier workbook).

Dear Dave,
That was an example to see if someone can suggest a solution.
Yes, for the example I gave, conditional formatting will help.
But what if instead of cell B2 to format, cell B2 value to be 100, els
B2 value to be 0 etc.

Is there any other method or code or so to overcome this problem
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top