PDA

View Full Version : Solved: Data double validation



IgnBan
03-05-2008, 08:01 PM
Good night everybody.
I got a question about data validation. How can I validate the data entry of a Sheet where the user by the action of pressing a macro button input current day summary data. What the macro does is copy at the end of working day totals of data collected and paste it to a table and a chart plots the data automatically.
My question is; how can I validate that the data is not entered twice and at the same time validate that is enter?
The data copied has a cell with the current day date that I think will be key for the validation. Here is the macro I wrote to paste the data;

Sub PasteDailyData()
Application.ScreenUpdating = False
Sheets("TAG-CHART").Select
Range("K87:U87").Select
Selection.Copy
Sheets("TAG_HISTORY").Select
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("SWITCHBOARD").Select

End Sub

types copied are;
Date, Percentage, Percentage, Percentage, Percentage and Number.

Sample workbook is attached.

Any ideas are in advance greatly appreciated :thumb

coliervile
03-14-2008, 07:51 AM
I'm no expert like those folks on here, but look at these articles:

http://www.cpearson.com/excel/deleting.htm

http://en.allexperts.com/q/Excel-1059/Duplicate-Rows-MS-Excel.htm

ProteanBeing
03-14-2008, 07:56 AM
Prior to entry you could use the .find method to search for the date in the sheet.

IgnBan
03-14-2008, 09:18 AM
Thanks for the replays Coliervile and ProteanBeing, I understand now the way to validate the entry with the .Find method, What method will be appropriate for when the workbook is about to close, How can I before closing the workbook validate that the data has been pasted?

Bob Phillips
03-14-2008, 09:21 AM
Use the BeforeClose event, and Cancel if not valid.

IgnBan
03-14-2008, 09:47 AM
Thanks XLD, I'll try that event.