+ Reply to Thread
Results 1 to 7 of 7

Run Time error 91 while updating texts in textbox in userform

  1. #1
    Registered User
    Join Date
    08-21-2012
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    12

    Run Time error 91 while updating texts in textbox in userform

    I have a userform with textboxes and listbox.

    All new values from my textbox I am able to add from textbox to an excel sheet.

    When it is coming for editing I am unable to update and save the edited data from textbox to that particular cell value.

    Following is my code for saving edited datas from textbox to particular sheet cell

    Please Login or Register  to view this content.
    ------------------------------------------------------------------

    While editing from "Ascot" to "Asco" I have no problem.
    But when I type any new alphabet in the textbox like from "Ascot" to "Ascot Royal" I get the Run time error 91 message.

    plz help. Thanks
    Last edited by Cutter; 08-22-2012 at 03:30 PM. Reason: Added code tags

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Run Time error 91 while updating texts in textbox in userform

    @ Cijo

    Welcome to the forum.

    Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.

  3. #3
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Run Time error 91 while updating texts in textbox in userform

    You don't check if there is a valid match, I suspect that is the case:

    Please Login or Register  to view this content.
    I suspect the employee.rows.offset(0,0).value = b.value isn't right either, where are you trying to place the name relative to the found name, and what do you really want to put in the cell?

  4. #4
    Registered User
    Join Date
    08-21-2012
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Run Time error 91 while updating texts in textbox in userform

    [QUOTE=cijo] Imagine I have to add one value say "Ascot" to a sheet cell from textbox using 'ADD" button. Later I want to change the value from Ascot to Ascot Royal to that same cell from same textbox using 'Save' button. This is my goal using 'save' button.

    Regarding string variable "Name"; when i click one value of listbox, 'b' textbox gets updated with the corresponding value from the cell. That value is stored in the variable 'Name'. That 'b' text value when i want to edit, I get this problem.

  5. #5
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Run Time error 91 while updating texts in textbox in userform

    The problem is Name and b have the same value. What you need to do is store the value of b in a separate control, say c, that is populated at the same time as b. Then, in the Click event, just replace Name with c.value:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-21-2012
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Run Time error 91 while updating texts in textbox in userform

    [QUOTE=cijo] Thanks Pal, its working, though not in the code you have given me, but your idea of storing the value of b in a separate control helped me in my problem.

    Thanks.

  7. #7
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Run Time error 91 while updating texts in textbox in userform

    @ Cijo

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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