+ Reply to Thread
Results 1 to 5 of 5

VBA _Change() command Question

  1. #1
    Registered User
    Join Date
    03-25-2009
    Location
    San Jose
    MS-Off Ver
    Excel 2007
    Posts
    83

    VBA _Change() command Question

    When I use that function on a UserForm it executes the code immediately, not waiting for the value to be entered.

    Thus the code executed that relies on the new values returns an incorrect value.

    Example

    A1 | 150
    A2 | 100 <-- this is the value being changed to 300 with the Textbox
    A3 | 250 = Sum(A1:A2)

    Now with:
    Please Login or Register  to view this content.
    it copies over the value of 250 while I'm changing the value to 300...

    Is there a way to get it to wait till I'm done changing the value first?
    Last edited by D3Pratt; 03-28-2009 at 06:55 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: VBA _Change() command Question

    Use the Exit event instead of the Change event.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    03-25-2009
    Location
    San Jose
    MS-Off Ver
    Excel 2007
    Posts
    83

    Re: VBA _Change() command Question

    Hmmm. How would that look in the code?

    I tried to add it in the way I would expect it to look... Got:

    Compile Error:
    Procedure declaration does not match description of event or procedure having same name

    Please Login or Register  to view this content.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: VBA _Change() command Question

    Use the left dropdown to select the control of interest, and the right dropdown to select the event, and you'll get the correct signature for the function.

  5. #5
    Registered User
    Join Date
    03-25-2009
    Location
    San Jose
    MS-Off Ver
    Excel 2007
    Posts
    83

    Re: VBA _Change() command Question

    Absolutely awesome! That did it.

    TYVM!

+ 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