PDA

View Full Version : Solved: Prevent Duplicate Date in Validation Code



canucklady
04-11-2007, 06:26 AM
Hello Everyone,

First of all I would like to thank everyone for all their help, you have saved me lots of time and frustration. I am very grateful for this forum.

I have yet another question, and I can't seem to find it in KB.

I know how to use Excel Validation, but when I run a Macro the Validation fails. Is there a code I could write into the Macro.

Basically I want error message to come up if the Date is already in Column A.

Bob Phillips
04-11-2007, 06:52 AM
With Activecell
If Application.Countif(.Columns(1),.Value)> 1 Then
MsgBox "Dupliacte value"
End If
End With

canucklady
04-11-2007, 12:40 PM
This still doesn't seem to be working, am I missing something?

Bob Phillips
04-11-2007, 01:10 PM
Show us the code that you have embedde it within.

canucklady
04-12-2007, 09:25 AM
Hi Here is the code, basically I want to prevent duplicate in column 1

Private Sub FillSalesList()
With Sheets("Sales").Columns(1).Rows(65536).End(xlUp)
.Offset(1, 0) = Sheet1.[G3]
.Offset(1, 1) = Sheet1.[G7]
.Offset(1, 2) = Sheet1.[G5]
.Offset(1, 3) = Sheet1.[I42]
.Offset(1, 4) = Sheet1.[I43]
.Offset(1, 5) = Sheet1.[I44]
.Offset(1, 6) = Sheet1.[G1].Text
.Offset(1, 7) = Sheet1.[G9].Text
.Offset(1, 8) = Sheet1.[B12].Text
End With
End Sub

Bob Phillips
04-12-2007, 10:06 AM
That is not validation code as I understand it, and it doesn't include the code I gave you.

canucklady
04-12-2007, 11:00 AM
xld, got your code to work, thank you very much