Consulting

Results 1 to 6 of 6

Thread: Solved: Data double validation

  1. #1
    VBAX Contributor
    Joined
    Jan 2008
    Posts
    104
    Location

    Solved: Data double validation

    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;

    [VBA]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[/VBA]

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

    Sample workbook is attached.

    Any ideas are in advance greatly appreciated
    Last edited by IgnBan; 03-06-2008 at 07:14 PM.

  2. #2
    VBAX Expert
    Joined
    May 2006
    Location
    Oklahoma City, OK
    Posts
    532
    Location
    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-105...s-MS-Excel.htm
    Best regards,

    Charlie

    I need all the I can get....

  3. #3
    VBAX Tutor
    Joined
    Oct 2007
    Posts
    210
    Location
    Prior to entry you could use the .find method to search for the date in the sheet.
    "The amount of stupid people in the world is God's way of punishing the smart people" - protean_being

  4. #4
    VBAX Contributor
    Joined
    Jan 2008
    Posts
    104
    Location
    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?

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Use the BeforeClose event, and Cancel if not valid.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    VBAX Contributor
    Joined
    Jan 2008
    Posts
    104
    Location
    Thanks XLD, I'll try that event.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •