+ Reply to Thread
Results 1 to 10 of 10

1 of 2 userforms not working due to change event

  1. #1
    Registered User
    Join Date
    02-09-2016
    Location
    FL
    MS-Off Ver
    2013
    Posts
    7

    1 of 2 userforms not working due to change event

    I have an incomplete project I have been working on and do not want to move on until I get this problem resolved (little things like this bug me). Perhaps I just need a second pair of eyes. However, the problem that I am having is that I am using a userform to update cells in a sheet. I have 2 userforms that are very similar and one works and the other does not. The suppliers editing part of the program is working just fine. It updates as expected. The customers userform will only update the first name in the sheet; the other fields remain unchanged and refresh as the same while no changes are made in the sheet. I pretty much copied and pasted the code from the suppliers over to the customers and made all of the appropriate changes that I found. I have looked over it for hours on end and just cannot figure out why all of the information in the customers cannot be updated.

    On a side note, while I was cleaning out most of the records from the sheet I got errors when I cleaned all of the records out, I have no clue how to handle these errors when there is no information in the sheets for the userforms to pull up. This error is not as pressing to me since the sheet will never be empty when in use, but it still bothers me knowing its there and not handled.

    Thank you ahead of time for any help and sorry for the long first post, its 4 am. so it is possible I have rambled

    Bitly
    Attached Files Attached Files
    Last edited by bitly; 02-17-2016 at 03:51 AM. Reason: title change for clarity

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Only 1 Cell updating in workbook through userform

    Step through your code. You will see what is going on.

  3. #3
    Registered User
    Join Date
    02-09-2016
    Location
    FL
    MS-Off Ver
    2013
    Posts
    7

    Re: Only 1 Cell updating in workbook through userform

    To be completely honest I am not sure how to step through it in excel. But if you could give me a clue as to how to do so I would greatly appreciate it. However, if it is too involved to explain, I understand.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Only 1 Cell updating in workbook through userform

    This is how I stepped through your code,it's on my You Tube channel.
    Step through userform code

    Possible issues could be, you are using rowsource for the combobox list or you are using rowindex. If you are not having that same issue in the other userform, find out the difference.

  5. #5
    Registered User
    Join Date
    02-09-2016
    Location
    FL
    MS-Off Ver
    2013
    Posts
    7

    Re: Only 1 Cell updating in workbook through userform

    Yeah I looked at both and I cannot find the difference. It updates the the first name cell but no others even though the code is written the same for both click commands. I am still stumped on this one.

  6. #6
    Registered User
    Join Date
    02-09-2016
    Location
    FL
    MS-Off Ver
    2013
    Posts
    7

    Re: Only 1 Cell updating in workbook through userform

    I have watched the video a few times in case I missed something. But I cant seem to find the difference between the one in customers that you posted and the one in suppliers in that same workbook. I know it has to be something simple, but Im still at a loss. Either way I have learned something new about stepping through code in a userform.

  7. #7
    Registered User
    Join Date
    02-09-2016
    Location
    FL
    MS-Off Ver
    2013
    Posts
    7

    Re: Only 1 Cell updating in workbook through userform

    Ok, so at least I can see now what seems to be the problem, I just cant fix it for some reason. The 2 userforms are using pretty identical code with no real differences. The Suppliers userform does not have the same problem even with the code being nearly identical. However, the customer userform is resorting to the change event before the sub finishes executing, therefore, only the first cell gets changed before triggering this change event. After a bit of googleing I found the EnableEvents property which had absolutely no effect on the outcome no matter where I placed it. So I am still stuck with no differences between the 2 userforms to compare for issues, but I do know that for some reason after the first line in the click sub executes it goes to the change sub which causes all other cells to not update. Any suggestions?

  8. #8
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Only 1 Cell updating in workbook through userform

    That's what I found as well.

    I still think it could be because using rowsource . When you changed the first cell(column A)
    you have changed the rowsource value and the combobox_change event kicks in.

    I populate my comboboxes & listboxes with either the range.value or with .additem.
    I would also find the selection from the combobox and then populate the textboxes.

    Rowsource maybe volatile and activates the combobox_change right away.

  9. #9
    Registered User
    Join Date
    02-09-2016
    Location
    FL
    MS-Off Ver
    2013
    Posts
    7

    Re: Only 1 Cell updating in workbook through userform

    I just dont get how it works flawlessly for the other userform in the same workbook. It just does not make sense. At this point I want to make it work this way just out of principal instead of letting it defeat me lol. Anyhow I do appreciate your time and input in this matter.

  10. #10
    Registered User
    Join Date
    02-09-2016
    Location
    FL
    MS-Off Ver
    2013
    Posts
    7

    Re: Only 1 Cell updating in workbook through userform

    I am going to mark this solved since I FINALLY figured it out. For anyone searching about a similar problem, the answer lay in the order in which you update the form and what you are using in your dropdown list. In my situation I was using the first name to populate the dropdown list box. The first item to be updated after hitting the edit button was the first name. As soon as you hit edit thinking it is going to go through and make all appropriate changes, it hits first name first and then that triggers the change event so none of the fields afterwards would be updated. All I did was simply move first name to be the last updated, and then the change event wouldnt take place until everything was updated. I cannot believe it took me this long to realize this and figure it out, but it was a very easy fix. Thanks for the help and input on this issue, hopefully this will help someone else in a similar situation.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. update cell/cells after updating a textbox on a userform
    By 40jmart1705 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2014, 03:07 PM
  2. [SOLVED] updating a parent workbook from a child workbook via Userform
    By smooth_beaker in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-01-2013, 08:39 AM
  3. Excel VBA - 1 Workbook, updating a specified cell in another workbook
    By Jiggles in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-22-2010, 02:23 AM
  4. Dynamically updating userform that lists worksheets and allows to edit one cell
    By bujaman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2010, 02:16 PM
  5. Multiple cell updating using userform
    By AGrace in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-10-2010, 06:22 AM
  6. Updating Data in Workbook using UserForm
    By DRkidd22 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-11-2009, 10:24 AM
  7. Using a userform for updating from closed workbook
    By ge0rge in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2009, 07:20 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