J
jeramie
i have a userform that shows at workbook open, and a shortcut key to reshow
it later if needed. the textboxes on the userform put names directly into
cells on the worksheet, then creates a filename and saves it. when i tab out
of a text box or click the command button, i need excel to check to see if
the corresponding cell is empty, and if not, is it different from the
textbox? if so, ask the user it he wants to keep the change.
i have this code in a macro module:
Sub TB3change()
If ThisWorkbook.Saved = True And UserForm1.Visible = True Then
With ThisWorkbook
If Worksheets("Page 1").Range("A3") <> "" And UserForm1.TextBox3.Text <>
"" Then
If UserForm1.TextBox3.Text = Worksheets("Page 1").Range("A3").Text
Then
Exit Sub
Else: UserForm1.TextBox3.SetFocus
If MsgBox("This entry has changed. Do You Want to keep this
change?", vbQuestion + vbYesNo, "Entry Exists") = vbYes Then
Worksheets("Page 1").Range("A3").Select
Application.Selection.Value = UserForm1.TextBox3.Text
Else: Exit Sub
End If
End If
End If
End With
End If
End Sub
any help would be greatly appreciated.
it later if needed. the textboxes on the userform put names directly into
cells on the worksheet, then creates a filename and saves it. when i tab out
of a text box or click the command button, i need excel to check to see if
the corresponding cell is empty, and if not, is it different from the
textbox? if so, ask the user it he wants to keep the change.
i have this code in a macro module:
Sub TB3change()
If ThisWorkbook.Saved = True And UserForm1.Visible = True Then
With ThisWorkbook
If Worksheets("Page 1").Range("A3") <> "" And UserForm1.TextBox3.Text <>
"" Then
If UserForm1.TextBox3.Text = Worksheets("Page 1").Range("A3").Text
Then
Exit Sub
Else: UserForm1.TextBox3.SetFocus
If MsgBox("This entry has changed. Do You Want to keep this
change?", vbQuestion + vbYesNo, "Entry Exists") = vbYes Then
Worksheets("Page 1").Range("A3").Select
Application.Selection.Value = UserForm1.TextBox3.Text
Else: Exit Sub
End If
End If
End If
End With
End If
End Sub
any help would be greatly appreciated.