+ Reply to Thread
Results 1 to 4 of 4

3 dependent textboxes in a userform

  1. #1
    Registered User
    Join Date
    11-24-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    15

    3 dependent textboxes in a userform

    Hi

    I am trying to create 3 textboxes in a userform, where the value in the boxes are inter-dependent (dont know if thats even a word...)

    I have made functions, so that when i enter a value in any of the 3 boxes, the code can calculate the value for the other 2...

    Problem is, that i kinda end up in a bad loop...

    I use the "afterupdate" event, to trigger the calculation of the 2 missing values... and assign that calculatet value to the 2 missing values... and that works fine.. but problem is that the assigning of the calculated values to the textboxes in it self triggers an "afterupdate"-event.. and a form of bad loop happens... cuz then the code try to calculate "back"

    Is there a way to get the code to reckognize when im manually entering a value (and for that trigger an afterupdate event, recalculating the value for the other 2 textboxes) or when a new value is enteret by the code (based on a function) and therefor not trigger the afterupdate event...??


    Kind regards

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,891

    Re: 3 dependent textboxes in a userform

    please disregard my post.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: 3 dependent textboxes in a userform

    Toggle the Application.EnabelEvents property to prevent triggering another event procedure.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: 3 dependent textboxes in a userform

    EnableEvents doesn't effect userform events, but you can get the same effect with a module wide boolean variable

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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