Closed Thread
Results 1 to 25 of 25

Userform with search and edit entries

  1. #1
    Registered User
    Join Date
    06-19-2018
    Location
    Beirut,Lebanon
    MS-Off Ver
    2017
    Posts
    25

    Userform with search and edit entries

    Hello guys,

    I am new to VBA and haven't actually learned VBA. I have some background on coding from JAVA and MatLAB. I have a client that needs a userform for data entry so I found one online and edited it a bit.

    1. However, the Find button sometimes finds an entry and I can edit it perfectly. However sometimes it doesn't find what I'm searching for even though I have previously added it.

    2. I am having an Invalid Property Error in the FindAll code. In textbox10 specifically, if I remove textbox10 i will get the error in textbox11 and then i will have it in the r=c.row

    Any help? I will post the code here and I can send you the entire excel file by email per your request

    Thank you in advance!


    Please Login or Register  to view this content.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,527

    Re: Userform with search and edit entries

    Better to desensitize your file and post it here.

    Include Userform and all code you are using now.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Registered User
    Join Date
    06-19-2018
    Location
    Beirut,Lebanon
    MS-Off Ver
    2017
    Posts
    25

    Re: Userform with search and edit entries

    Do you want me to attach the excel file to this forum?

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,527

    Re: Userform with search and edit entries

    If possible, YES.

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  5. #5
    Registered User
    Join Date
    06-19-2018
    Location
    Beirut,Lebanon
    MS-Off Ver
    2017
    Posts
    25

    Re: Userform with search and edit entries

    I have attached the excel file to the post.

    I deleted all rows yet the first entry after deletion started on row 3 and skipped the first 2 rows.

    As you can see, if you type Marc in the Name box and press find it will only find 1 result even though there are 2 instances of Marc.

    If you type Michel it will not find it.
    Attached Files Attached Files

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Userform with search and edit entries

    You should not set form heights to values that may display incorrectly on other systems with different screen resolutions.
    Not good coding, If you copy code and do not know what it does, check it first before sending it to others.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Userform with search and edit entries

    You do not fill the listbox so there is nothing to list, therefore the error

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,527

    Re: Userform with search and edit entries

    This should do it.

    Test it and let us know.
    Attached Files Attached Files

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Userform with search and edit entries

    Looks good

  10. #10
    Registered User
    Join Date
    06-19-2018
    Location
    Beirut,Lebanon
    MS-Off Ver
    2017
    Posts
    25

    Re: Userform with search and edit entries

    Dear Mr Bakerman,

    Thank you for taking the time to help me with my code, however I tried your code and still have the same problems. The form you sent has 2 entries of Marc and 2 of Michel if you search for any of them both say Marc not listed or Michel not listed. Furthermore, I added 2 more entries "Camelia" (attached the new file here) and if you search for Camelia it only returns 1 row and not both.

    If you may please help me again because I have no knowledge in VBA and just need this to work and finish all my business with VBA.

    Thanks again
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-19-2018
    Location
    Beirut,Lebanon
    MS-Off Ver
    2017
    Posts
    25

    Re: Userform with search and edit entries

    Dear Keebellah,

    I'm sorry for any problems this may have caused, but as I told you I have zero background info about VBA. Just a few coding tools. So I didnt know about this before hand. Thanks for the tip!

  12. #12
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Userform with search and edit entries

    Please keep in mind that the names entered have to be the same.
    Camelia is visually the same but the second Camelia has a blank behind the name and for Excel that is an extra character even if YOU don't see it.
    So be careful how you enter your values and what is in the cells. a blank (space) is character too.

  13. #13
    Registered User
    Join Date
    06-19-2018
    Location
    Beirut,Lebanon
    MS-Off Ver
    2017
    Posts
    25

    Re: Userform with search and edit entries

    This is another edit, I checked you were right the second "Camelia" has a space before it, even though I didn't insert it, it was just there.

    Now both are the same (i hope) yet still not results.
    Attached Files Attached Files

  14. #14
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Userform with search and edit entries

    Yeah, 'I didn't insert it' perfect excuse but YOU are the one using the file so you're responsible
    That the code doesn't do what you want, well my guess is that it needs to be reviewed completely.
    Since you do not work with VBA (or do not want to work with VBA) I guess you should contact the person that wrote this for you before you posted it on the forum.
    Even if it is a one time project ...
    If you have a coding background in Java and Matlab, well it;s not much different. coding is coding, the logic is the same only the syntax varies a little but the main idea is to translate the thoughts of what you are doing and what you want from writing to code.
    What is it exactly that you need to have it do?

  15. #15
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,527

    Re: Userform with search and edit entries

    It works just fine only after you have entered the name you need to click the Find-Button above the Listbox.

  16. #16
    Registered User
    Join Date
    06-19-2018
    Location
    Beirut,Lebanon
    MS-Off Ver
    2017
    Posts
    25

    Re: Userform with search and edit entries

    Thank you guys for the help.

    I think it works now.

    Thank you for taking the time to help.

  17. #17
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Userform with search and edit entries

    @bakerman2: it doesn't work for him and the reason is that the search is case sensitive.
    If you enter marc it will tell you there are two entries but they do not show in the listbox.
    I modified the code so that the textbox1 contents are forced to initial upercase (worksheet function Proper) and then it works like the OP wants

    My fingers itch to rewrite the code but this will do it for the OP,
    Attached Files Attached Files

  18. #18
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,527

    Re: Userform with search and edit entries

    The ultimate solution is to replace the Name TextBox with a Combobox that is filled with all the unique values from Name Column.
    That way you just select a name so uppercase, lowercase, spaces, etc... don't matter anymore.

    Anyway glad to help.

  19. #19
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Userform with search and edit entries

    A modification that helps the search,
    Will need some editing but this works too
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    06-19-2018
    Location
    Beirut,Lebanon
    MS-Off Ver
    2017
    Posts
    25

    Re: Userform with search and edit entries

    I just checked it out. thats great! and i think it works pretty well

    thanks a lot!

  21. #21
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Userform with search and edit entries

    You're welcome

  22. #22
    Registered User
    Join Date
    06-19-2018
    Location
    Beirut,Lebanon
    MS-Off Ver
    2017
    Posts
    25

    Re: Userform with search and edit entries

    Mr Keebellah,

    I sent you a private message.

    Please confirm if you have received it

  23. #23
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Userform with search and edit entries

    Mr Marchenrysaad,
    I have seen and read it.
    At this moment I am not able to help you. Will be away for about 2 weeks.
    Upon my return I shall see if I understand what you require and will gladly help you (if I can)
    In the meantime; the code is not that difficult and maybe you should take the 'risk' and try some changes, it will help you understand VBA too.

  24. #24
    Registered User
    Join Date
    07-28-2024
    Location
    Philippines
    MS-Off Ver
    Microsoft 365
    Posts
    1
    Quote Originally Posted by Keebellah View Post
    A modification that helps the search,
    Will need some editing but this works too
    Hi.. What if you want to search a keyword across all columns? Would that be possible?

  25. #25
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,862

    Re: Userform with search and edit entries

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar or even the same as this thread, we have a rule that you open your own thread on the issue and do not piggy back another member's thread.

    Please see Forum Rule #1 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Userform with with search and edit entries
    By Marchenrysaad in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-20-2018, 02:27 PM
  2. [SOLVED] Userform - Search, Edit & Update
    By nancyching1711 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 03-09-2018, 05:34 AM
  3. USERFORM : Search and edit data in userform
    By mohit.kumar9094 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2018, 07:50 AM
  4. [SOLVED] restrict a search to either text entries or date entries when loading dynamic userform
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-28-2017, 06:06 AM
  5. [SOLVED] Edit Previous Entries in Userform and Update Table
    By Adangelo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-19-2017, 03:07 PM
  6. [SOLVED] Need userform to search and edit records
    By Damian37 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-30-2014, 03:16 PM
  7. [SOLVED] Search and edit data in a Userform
    By flashdisk in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-11-2013, 08:27 AM

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