+ Reply to Thread
Results 1 to 4 of 4

Can a UserForm have a change event?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-04-2014
    Location
    Tetbury, England
    MS-Off Ver
    Excel 2010
    Posts
    254

    Can a UserForm have a change event?

    Hello

    I have multiple change event Private Subs for many textboxes in my userform, such as:

    Private Sub txtY1B2E_PAYE_Change()
        txtY1B3S_PAYE.Value = txtY1B2E_PAYE.Value
    End Sub
    I tried combining these into one Change event but it doesn't seem to work. Is that because it just won't work or is there a way around it?

    Private Sub frmWorkforceProjections_Change()
        txtY1B3S_PAYE.Value = txtY1B2E_PAYE.Value
        txtY1B4S_PAYE.Value = txtY1B3E_PAYE.Value
        txtY1B5S_PAYE.Value = txtY1B4E_PAYE.Value
        txtY1B6S_PAYE.Value = txtY1B5E_PAYE.Value
        txtY2B3S_PAYE.Value = txtY2B2E_PAYE.Value
        txtY2B4S_PAYE.Value = txtY2B3E_PAYE.Value
        txtY2B5S_PAYE.Value = txtY2B4E_PAYE.Value
        txtY2B6S_PAYE.Value = txtY2B5E_PAYE.Value
        txtY3B3S_PAYE.Value = txtY3B2E_PAYE.Value
        txtY3B4S_PAYE.Value = txtY3B3E_PAYE.Value
        txtY3B5S_PAYE.Value = txtY3B4E_PAYE.Value
        txtY3B6S_PAYE.Value = txtY3B5E_PAYE.Value
        txtY4B3S_PAYE.Value = txtY4B2E_PAYE.Value
        txtY4B4S_PAYE.Value = txtY4B3E_PAYE.Value
        txtY4B5S_PAYE.Value = txtY4B4E_PAYE.Value
        txtY4B6S_PAYE.Value = txtY4B5E_PAYE.Value
        txtY5B3S_PAYE.Value = txtY5B2E_PAYE.Value
        txtY5B4S_PAYE.Value = txtY5B3E_PAYE.Value
        txtY5B5S_PAYE.Value = txtY5B4E_PAYE.Value
        txtY5B6S_PAYE.Value = txtY5B5E_PAYE.Value
    
        txtY1B3S_NICer.Value = txtY1B2E_NICer.Value
        txtY1B4S_NICer.Value = txtY1B3E_NICer.Value
        txtY1B5S_NICer.Value = txtY1B4E_NICer.Value
        txtY1B6S_NICer.Value = txtY1B5E_NICer.Value
        txtY2B3S_NICer.Value = txtY2B2E_NICer.Value
        txtY2B4S_NICer.Value = txtY2B3E_NICer.Value
        txtY2B5S_NICer.Value = txtY2B4E_NICer.Value
        txtY2B6S_NICer.Value = txtY2B5E_NICer.Value
        txtY3B3S_NICer.Value = txtY3B2E_NICer.Value
        txtY3B4S_NICer.Value = txtY3B3E_NICer.Value
        txtY3B5S_NICer.Value = txtY3B4E_NICer.Value
        txtY3B6S_NICer.Value = txtY3B5E_NICer.Value
        txtY4B3S_NICer.Value = txtY4B2E_NICer.Value
        txtY4B4S_NICer.Value = txtY4B3E_NICer.Value
        txtY4B5S_NICer.Value = txtY4B4E_NICer.Value
        txtY4B6S_NICer.Value = txtY4B5E_NICer.Value
        txtY5B3S_NICer.Value = txtY5B2E_NICer.Value
        txtY5B4S_NICer.Value = txtY5B3E_NICer.Value
        txtY5B5S_NICer.Value = txtY5B4E_NICer.Value
        txtY5B6S_NICer.Value = txtY5B5E_NICer.Value
    
        txtY1B3S_NICee.Value = txtY1B2E_NICee.Value
        txtY1B4S_NICee.Value = txtY1B3E_NICee.Value
        txtY1B5S_NICee.Value = txtY1B4E_NICee.Value
        txtY1B6S_NICee.Value = txtY1B5E_NICee.Value
        txtY2B3S_NICee.Value = txtY2B2E_NICee.Value
        txtY2B4S_NICee.Value = txtY2B3E_NICee.Value
        txtY2B5S_NICee.Value = txtY2B4E_NICee.Value
        txtY2B6S_NICee.Value = txtY2B5E_NICee.Value
        txtY3B3S_NICee.Value = txtY3B2E_NICee.Value
        txtY3B4S_NICee.Value = txtY3B3E_NICee.Value
        txtY3B5S_NICee.Value = txtY3B4E_NICee.Value
        txtY3B6S_NICee.Value = txtY3B5E_NICee.Value
        txtY4B3S_NICee.Value = txtY4B2E_NICee.Value
        txtY4B4S_NICee.Value = txtY4B3E_NICee.Value
        txtY4B5S_NICee.Value = txtY4B4E_NICee.Value
        txtY4B6S_NICee.Value = txtY4B5E_NICee.Value
        txtY5B3S_NICee.Value = txtY5B2E_NICee.Value
        txtY5B4S_NICee.Value = txtY5B3E_NICee.Value
        txtY5B5S_NICee.Value = txtY5B4E_NICee.Value
        txtY5B6S_NICee.Value = txtY5B5E_NICee.Value
    End Sub

  2. #2
    Forum Contributor pareshj's Avatar
    Join Date
    05-20-2014
    Location
    MUMBAI
    MS-Off Ver
    2007 & 2010
    Posts
    447

    Re: Can a UserForm have a change event?

    Hi,

    Have you created control array of textboxes or is it normal textboxes?

    Check the below links:
    For Control array of textboxes:
    http://p2p.wrox.com/access-vba/37472...l-changed.html

    For Normal TextBoxes:
    1) http://www.mrexcel.com/forum/excel-q...same-code.html
    2) http://codereview.stackexchange.com/...out-sacrifices


    Regards,
    Paresh J
    Click on "* Add Reputation" as a way to say thanks

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,971

    Re: Can a UserForm have a change event?

    You can't have one change event but you could have one routine that updates all the textboxes and call that from the change event of each one. Not sure if that applies to what you're trying to do though.
    Everyone who confuses correlation and causation ends up dead.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,480

    Re: Can a UserForm have a change event?

    I have recently written up information on using a central event handler.
    http://www.andypope.info/vba/ufevents.html
    Cheers
    Andy
    www.andypope.info

+ 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. cant keep typing in userform textbox after change event
    By jed38 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-01-2014, 09:13 AM
  2. Couple of Userform, Change event queries
    By welshman010 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-24-2014, 08:46 PM
  3. [SOLVED] UserForm Change of data value event- Label show or hide
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-16-2014, 11:54 AM
  4. [SOLVED] UserForm ComboBox Change Event Question
    By tja1964 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2012, 07:21 PM
  5. Userform Multipage Event Change
    By sepandb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-31-2008, 01:40 PM

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