Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Art Art is offline
external usenet poster
 
Posts: 587
Default If duplicate in range

Hello:

I have a range from A1:A50. I would like to have a code that if I enter an
amount in a cell that is already included in another cell, then it should not
let me, or notify me with msgbox.

Thanks so much.

Art
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default If duplicate in range

You can use the Worksheet function COUNTIF() to check..

Sub Macro()
intNum = 50
If WorksheetFunction.CountIf(Range("A1:A50"), intNum) 0 Then
MsgBox "Number already exist": Exit Sub
End If

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"art" wrote:

Hello:

I have a range from A1:A50. I would like to have a code that if I enter an
amount in a cell that is already included in another cell, then it should not
let me, or notify me with msgbox.

Thanks so much.

Art

Reply
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Identifying duplicate values in a range Paul Excel Discussion (Misc queries) 1 May 3rd 09 10:31 PM
Sorting a range with duplicate values Jayen Excel Programming 5 November 26th 08 02:09 PM
duplicate a range a specified number of times Tbone Excel Programming 2 May 4th 07 09:37 PM
No duplicate names in a range (A2:A200) JorgeAE Excel Worksheet Functions 2 April 3rd 06 02:04 AM
Delete Duplicate rows in a range UK[_2_] Excel Programming 1 April 14th 04 01:28 PM


All times are GMT +1. The time now is 07:22 PM.

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

About Us

"It's about Microsoft Excel"