+ Reply to Thread
Results 1 to 5 of 5

Different version:Userform to edit data

  1. #1
    Registered User
    Join Date
    05-27-2011
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    72

    Different version:Userform to edit data

    Trying to make a different version of this code:

    Please Login or Register  to view this content.
    Instead of adding a new row I would like it to find the matching Serial (in column A) and have the data replace that row.
    Last edited by nohero; 06-30-2011 at 01:44 PM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    re: Different version:Userform to edit data

    nohero,

    Give this a try:
    Please Login or Register  to view this content.


    Hope that helps,
    ~tigeravatar

  3. #3
    Registered User
    Join Date
    05-27-2011
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    72

    re: Different version:Userform to edit data

    Almost where I need to be, there's one small situational glitch. In my actual code the txtSerial isn't input by the user, it's pulled from another cell to show as a label in the userform so it cannot be edited in the userform itself by the user. So my code looks like this:

    Please Login or Register  to view this content.
    My problem comes from the format of the source cell "D3". It is in a 5-digit format that can have zeroes to start. The .Find function in the code is not requiring a perfect match. For example, when I have the number 01234 in cell D3 and submit the form it's finding serial 12345 and changing that row because it's searching for "1234" and finds it in the first 4 characters of the 12345 and that one comes first in the list.

    How can I make sure the .Find function looks for the complete 5-digit code and only accepts a perfect match even when starting with zeroes?

    I tried changing it to .Text but then it finds nothing at all and just creates a new row.

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    re: Different version:Userform to edit data

    nohero,

    Need to add the LookAt:=xlWhole to the .Find() method. Try the following:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-27-2011
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    72

    re: Different version:Userform to edit data

    Thanks again! Works exactly as intended!

+ 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