+ Reply to Thread
Results 1 to 6 of 6

How can I make changes from more than 1 Textbox/Combobox?

  1. #1
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    How can I make changes from more than 1 Textbox/Combobox?

    Hi,

    I have the following code that i would also like to conveniently execute from ComboBox20(and possibly more). I have enquired about this previously and had a great solution from xlnitwit.
    However, I potentially have many of these to change and don't want to re-title lots of code. Any ideas??


    Please Login or Register  to view this content.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: How can I make changes from more than 1 Textbox/Combobox?

    bralew,

    One option is to add the textboxes that should behave this way to a class.
    That way you can trigger the same event for a number of textboxes.

    However... it means that they all follow the same logic... you can make all textboxes check the text of combobox20 and then do math by multiplying their own number by the value, but if combobox20 changes text then how do you know which textbox's value to multiply to update 36?

    But maybe I'm just not understanding exactly what should be happening.
    Last edited by Arkadi; 12-07-2016 at 11:35 AM.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: How can I make changes from more than 1 Textbox/Combobox?

    I can copy this code and simply place it in ComboBox20, and in some code I have and it works great. However, this has considerations in terms of maintenance and I'd rather update one
    area as opposed to multiple.

  4. #4
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: How can I make changes from more than 1 Textbox/Combobox?

    A class, that sounds interesting?

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: How can I make changes from more than 1 Textbox/Combobox?

    Agreed, but what I mean is...
    When textbox 15 changes, 36 is updated depending on value of combo20.
    You want to add more... but would they always check 20 and update 36 based on 15?
    If it is always the exact same calculation then just make a sub called something like "sub update36()" and then just use "Call update36" in each of your change events... that way you only need to maintain one piece of code.

    Class modules can be handy, but it is overkill if you always just want the same calculation based on the same items.

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: How can I make changes from more than 1 Textbox/Combobox?

    If the calculation in question is based on the box that changes, meaning if textbox 15 changes something happens based on its own value, and then if 17 changes, then the same thing happens but based on the value of 17, etc, then class modules can become helpful. If that's the case let me know and we can go over an example of what you would do.

+ 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. Replies: 0
    Last Post: 08-18-2015, 04:13 PM
  2. [SOLVED] Make combobox list options dependant on selection in another combobox within a userform
    By Vladimir_Dobvchenko in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-23-2013, 05:30 AM
  3. input the value of a Combobox and a textbox to a TEXTBOX directly from a userform
    By Gordonhk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-11-2013, 03:25 PM
  4. [SOLVED] Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox select
    By MileHigh_PhD in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 04:50 PM
  5. [SOLVED] How do I make a selection from a combobox on my VBA userform populate a textbox?
    By ChristianMba in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-16-2012, 01:08 PM
  6. make textbox visible on condition of combobox selection
    By zebra in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-17-2009, 10:48 AM

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