Thread: Pop up Box
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default Pop up Box

No problem, Randy. One of the main reasons to keep it in the same thread is
that many newsreaders will allow you to check if there are any replies to
your posts. So when I checked to see if there were any replies to my post
in the original thread, I didn't see any. It was just luck that I happened
upon your second post. Another reason is that users that have your same
question in the future may not find the answer as easily if you start a new
thread.

Glad we were able to solve your problem!

--
Regards,

Jake Marx
www.longhead.com


Randy wrote:
Thanks for your help Jake. I copied and pasted the entire
thread hoping to eliminate confusion, but apparently
caused more by doing so. Sorry :-(
-----Original Message-----
Hi Randy,

Please try to keep followup questions in the original thread so
people know what you're referring to.

If you want to do this via VBA code, you can put it in the
Worksheet_Change event. Here's an example:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, _
Rows(2)) Is Nothing Then
If Application.WorksheetFunction.CountIf( _
Rows(2), "=" & Target.Value) 1 Then
MsgBox "Please enter a unique value."
Target.ClearContents
Target.Select
End If
End If
End Sub

Just right-click the tab of the worksheet you'd like to monitor,
then select View Code. Paste this code into the resulting code pane.

--
Regards,

Jake Marx
www.longhead.com


Randy wrote:
From a previous post.....

When entering a cell value and a dupilicate exists in
the same cell different column, I would like a pop up that
says "Please Enter a Unique Value"
All help would be appreciated
Thanks!


You can do this with Data | Validation. Just select row
2, select Data |
Validation, then select Custom and enter this formula:

=COUNTIF($2:$2,"=" & A2)=1

Under the Error Alert tab, you can enter the error
message you'd like
displayed when users enter bad data. Unfortunately,
copying/pasting will
destroy the data validation, so this will not stop
someone from
copying/pasting data onto row 2.


...I would like to add this to an existing macro that I am
already using
Thanks!


.