ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Help please - warning messages (https://www.excelbanter.com/excel-worksheet-functions/231752-help-please-warning-messages.html)

adickson

Help please - warning messages
 
I am trying to put a warning message on cell that will pop up if the value of
that cell is not the same as the value of another cell. (using data
validation). My problem is that the cell I am trying to put the warning on
has a vlookup formula in it and therefore the warning message does not work.

Is there a way to do this? Please help!!
Thanks,
Angela

Simon Lloyd[_243_]

Help please - warning messages
 

adickson;355328 Wrote:
I am trying to put a warning message on cell that will pop up if the
value of
that cell is not the same as the value of another cell. (using data
validation). My problem is that the cell I am trying to put the warning
on
has a vlookup formula in it and therefore the warning message does not
work.

Is there a way to do this? Please help!!
Thanks,
AngelaYou can use this code in the worksheet code module, you could use

something similar to the body of the code for the worksheet calculate if
need be:

Code:
--------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim pC As String
'remember our cell
pC = Target.Address
'the cell we are checking the value in
If Target.Address < "$A$1" Then Exit Sub
' the cell we are checking against
If Target.Value < Me.Range("B1").Value Then
'show a message
MsgBox "The value of cell " & Target.Address & " is different from B1", vbInformation, "Unequal Value Found!"
'go back to our cell we checked
Range(pC).Select
End If
End Sub
--------------------


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=99714



All times are GMT +1. The time now is 09:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com