+ Reply to Thread
Results 1 to 3 of 3

Validate Data using Class Module

  1. #1
    Registered User
    Join Date
    04-27-2012
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    63

    Validate Data using Class Module

    I am struggling with creating a data validation button!

    My spreadsheet has several columns (Invoice Number, Vendor, Amount Due, and Approval Date) in which a user fills out the userform and hits save and the data is entered into the next row of the correct column.

    Now I would like to add a 'Validate' button to the spreadsheet which, when clicked, will run through each row and check that the values in each cell are valid entries (ie. Invoice number as string, vendor as string, amount due as double, due date as date).

    I have created a class module, and some functions to create class objects from both the sheet data and the data from the userform (with help from others). I am in a little (read: a lot!) over my head with this whole class module thing, so if someone has some advice or better idea I would GREATLY appreciate it!


    Excel Help Validate.xlsm

  2. #2
    Forum Contributor
    Join Date
    12-26-2010
    Location
    Kansas City, Kansas
    MS-Off Ver
    Excel 2007
    Posts
    147

    Re: Validate Data using Class Module

    Hi
    Here is code to revised your Sheet 1 Module Code
    Please note the comments - you MUST change the property of
    your Class1 (Use F4 key) from Private to PublicNotCreatable
    as commented in the code below.

    I have NOT fixed any of the other code errors.

    EDIT-EDIT-EDIT
    I forgot to state that for my ease - I created a new ActiveX button whose Name is
    cmdValidateData and I put the code in that CLICK EVENT. You would put the code
    in whatever Macro you are using to call the class.

    HTH
    John


    Please Login or Register  to view this content.
    Last edited by JohnM3; 06-15-2012 at 09:44 AM. Reason: Forgot something

  3. #3
    Registered User
    Join Date
    04-27-2012
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    63

    Re: Validate Data using Class Module

    Thank you for your help! I will continue researching and working with this code. I really appreciate the jump start you've given me!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1