+ Reply to Thread
Results 1 to 11 of 11

Class module for userform textboxes

  1. #1
    Registered User
    Join Date
    06-01-2020
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    5

    Class module for userform textboxes

    I have
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    and so on for 40 textboxes
    What would be the class module for 40 textboxes.

  2. #2
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: Class module for userform textboxes

    Sorry, I was wrong,misunderstand the question.
    Last edited by dotchiejack; 06-02-2020 at 02:48 AM.
    Click the * Add Reputation below to say thanks.

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

    Re: Class module for userform textboxes

    You need to post example file as your current code is not clear on how it is used.
    On the surface it looks like you are multiplying the contents of a textbox by the contents of another textbox. But as you are doing this in the change event everytime you update the textbox it will trigger the change event again and carry on in a loop.

    Your class would need to include 2 textbox objects.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    06-01-2020
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    5

    Re: Class module for userform textboxes

    Hi Andy,
    Thanks for responding.
    I made a small example, but I have a whole list like this.
    Please advice.
    Attached Files Attached Files

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

    Re: Class module for userform textboxes

    Userform module
    Please Login or Register  to view this content.
    Class module, Class1
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    06-01-2020
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    5

    Re: Class module for userform textboxes

    Thank you Andy,great job.

  7. #7
    Registered User
    Join Date
    06-01-2020
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    5

    Re: Class module for userform textboxes

    Hi, I have a next question.
    What would be te cllas module solution if I want the total of the 3 TextBoxt textboxes.
    Thanks to look into my problem.
    Attached Files Attached Files
    Last edited by Knoet; 06-03-2020 at 12:18 PM.

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

    Re: Class module for userform textboxes

    You could have added a public sub to the userform and used that.
    But I have used another class object to centralise the callbacks to the userform.


    Class module, CEventListener

    Please Login or Register  to view this content.
    revised Class1 module code
    Please Login or Register  to view this content.
    revised userform code
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    06-01-2020
    Location
    Belgium
    MS-Off Ver
    2016
    Posts
    5

    Re: Class module for userform textboxes

    Hi Andy,
    Thank you for your reply.
    I have a problem as we use comma's instead of dots, the calculatins are not correct. I tryed to replace the comma's by dots but i still have wrong calculations.
    Any ideas?
    Thanks

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

    Re: Class module for userform textboxes

    If the issue is with numeric separators and decimal delimiter, then it would not have been working for you at the start.

    I assume for you the number ten you would use comma for decimal 10,0 rather than the period I would expect with UK settings 10.0

    What does the VAL function return for the test values? You will need to step through the code and check or use debug.print commands to write to the immediate window

  11. #11
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: Class module for userform textboxes

    Quote Originally Posted by Knoet View Post
    ... I have a problem as we use comma's instead of dots, the calculatins are not correct. I tryed to replace the comma's by dots but i still have wrong calculations ...
    How did you try to change it ?

    Just use the 'Replace' function to achieve the desired effect, e.g.:
    Please Login or Register  to view this content.

+ 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. Custom Class Module for multiple UserForm controls?
    By AnthonyGFS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-25-2018, 03:36 AM
  2. Place code in userform, module or class module
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-16-2017, 07:04 AM
  3. Add Property to UserForm via class module - please help
    By jaryszek in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-07-2016, 09:35 AM
  4. [SOLVED] Userform ComboBox Class Module not working
    By rodgersmg in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-24-2016, 03:23 AM
  5. [SOLVED] Userform & Dynamic Controls & Class Module
    By sarndt01 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 09-18-2014, 01:53 PM
  6. Compare even and odd numbered TextBoxes in a class module
    By KratjeBier2 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-03-2014, 03:39 PM
  7. Replies: 1
    Last Post: 10-12-2012, 04:36 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