That was for the multiple undos, which it said it could do (and what you wanted).
But it's also easy to know which textbox was last edited.
Code:Dim lastedit As Integer Private Sub Form_Load() lastedit = 0 End Sub Private Sub Text1_Change() lastedit = 1 End Sub Private Sub Text2_Change() lastedit = 2 End Sub Private Sub Text3_Change() lastedit = 3 End Sub Private Sub Command1_Click() If lastedit = 0 Then Exit Sub 'no textbox edited ElseIf lastedit = 1 Then Text1.SetFocus SendKeys "^z", True 'text1 last edited ElseIf lastedit = 2 Then Text2.SetFocus SendKeys "^z", True 'text2 last edited ElseIf lastedit = 3 Then Text3.SetFocus SendKeys "^z", True 'text3 last edited End If End Sub




Reply With Quote