LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Pop up Box

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!


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"