+ Reply to Thread
Results 1 to 7 of 7

macro to prevent double record data

  1. #1
    Registered User
    Join Date
    07-09-2013
    Location
    Indonesiania
    MS-Off Ver
    Excel 2007
    Posts
    3

    macro to prevent double record data

    hello..
    I have problem in my project, when I input data in my "userform", I want to make a message box and prevent the data record if the same data have been recorded before....
    Please help me...?
    I can't upload my worksheet because it too large to upload...
    anyone can give me the basic "command"?

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: macro to prevent double record data

    There no "basic" command because there is more than one way to go about it.

    Here are some suggestions:

    1. Use the FIND method to search the target sheet, passing the relevant search criteria from the form to the

    2. Declare a variable (Long type) and use the WorksheetFunction.Countif in VBA code, again, passing the relevant criteria from the form to the COUNTIF function

    So if you user form contained a text box and want to test if the entry exist in sheet1 you might have code similar to this (written on the fly in this reply and not test - give as an example only).

    Please Login or Register  to view this content.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Registered User
    Join Date
    07-09-2013
    Location
    Indonesiania
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: macro to prevent double record data

    Thanks palmetto, I'll try this one..
    So, I just change the sheet1 with my worksheet and textbox with the one that I record..
    What is "c" function here?
    I don't too familiar with this one yet...

  4. #4
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: macro to prevent double record data

    "c" is a variable declared as Range type. We could have "rCell" or "rngCell" or "rFound" - any name we want for the variable.

    It is used with the Find Method to establish the cell as a range object, assuming the value that is searched for is found on the worksheet.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: macro to prevent double record data

    HI oxxy and welcome to the Forum!!

    Regarding this
    I can't upload my worksheet because it too large to upload...
    Zip the File then try the Upload...
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  6. #6
    Registered User
    Join Date
    07-09-2013
    Location
    Indonesiania
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: macro to prevent double record data

    this is the project's file I've been working on..
    please help me.. the deadline is running out..
    thank you before..
    Attached Files Attached Files

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: macro to prevent double record data

    HI oxxy

    I'd suggest there's a problem with your file...there's no way it should be that large...un-zipped...33,000 plus KB...don't see it...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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