Warn when a cell value has changed

L

LesLdh

I have a user entered value in cell A1. What I want to do is have a reminder
to update other cells flash up in cell A2 when the value in A1 is changed

Any ideas?
 
O

Otto Moehrbach

How about a message box? Paste the following macro into the sheet module
for that sheet. You do this by right-clicking on the sheet tab, select View
Code, and paste this macro into the displayed module. HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Address(0, 0) = "A1" Then _
MsgBox "Don't forget to do this and that also."
End Sub
 
L

LesLdh

Thanks Otto, just what I was looking for. Les.

Otto Moehrbach said:
How about a message box? Paste the following macro into the sheet module
for that sheet. You do this by right-clicking on the sheet tab, select View
Code, and paste this macro into the displayed module. HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Address(0, 0) = "A1" Then _
MsgBox "Don't forget to do this and that also."
End Sub
 
L

LesLdh

Now, if there is a second user entered value in B1 how would I amend the
formula to give the reminder if either value is changed. Also, is it possible
to prevent the msgbox alert when the initial value is entered? Les.
 
O

Otto Moehrbach

I don't follow what you want but let me give it a try. You want the message
box to pop up if an entry is made into either of the two cells but only if
the other cell is already occupied (not blank). Is that correct?
You first asked to include B1. IOW, if either cell is changed. That code
would be:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Address(0, 0) = "A1" Or Target.Address(0,0)="B1" Then _
MsgBox "Don't forget to do this and that also."
End Sub

Also, let me ask you a question. Do you want this message box to appear if
the user changes the content of the cell to blank? Or just if he changes
the content but not to blank? IOW, ignore the change if the changed cell is
now blank?

If you want the message box if either cell is changed, but not to blank, and
only if the other cell is already occupied, then the following will do that:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
If Target.Address(0, 0) = "A1" Or Target.Address(0, 0) = "B1" Then
If Application.CountA(Range("A1:B1")) = 2 Then _
MsgBox "Don't forget to do this and that also."
End If
End Sub

HTH Otto
 
L

LesLdh

Well, I didn't think you could do that! Thanks Otto, you were correct in
assuming that I wanted the msgbox just if he changes the content but not to
blank?

Many thanks for your time, Les.
 
O

Otto Moehrbach

Glad it worked for you. Otto
LesLdh said:
Well, I didn't think you could do that! Thanks Otto, you were correct in
assuming that I wanted the msgbox just if he changes the content but not
to
blank?

Many thanks for your time, Les.
 

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

Top