+ Reply to Thread
Results 1 to 3 of 3

Button to fill textbox with integer not functioning + iteration of checkboxes too slow.

  1. #1
    Registered User
    Join Date
    06-18-2013
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2013
    Posts
    81

    Button to fill textbox with integer not functioning + iteration of checkboxes too slow.

    Hi,
    I have 125 checkboxes each assigned an int value of 1-5 (see loop). I then have a button that I need to populate a txtbox with the summed value of all checked boxes

    Need help with these 2 problems.

    1. The iteration of the loop is very slow when I check the boxes on the word doc. It sometimes freezes for about 5-8 seconds after checking a box.
    However, I do know it is correctly counting the integers. Any idea how to make my loop more efficient? It shouldn't be this slow.

    2. My button wont work to fill in the txtbox with the int total. I'm new to VB in MS W.
    (I only know the Int of total_score() adds correctly because of my msgbox which I hope to remove.



    Please Login or Register  to view this content.
    Please help!!! If I get this fixed it will be great!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Button to fill textbox with integer not functioning + iteration of checkboxes too slow

    There is an option button click event.

    So if you have use a variable or 5 variables and increment the appropriate one if an option button goes true and decrement it when it goes false.

    Then there is no need for your loop.

    What is this line supposed to do?
    Please Login or Register  to view this content.
    Have you declared total_score as a global variable?
    why not simply write x into your textbox?

  3. #3
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Button to fill textbox with integer not functioning + iteration of checkboxes too slow

    It seems to me the code could be reduced to:
    Please Login or Register  to view this content.
    Last edited by macropod; 01-19-2014 at 06:57 AM. Reason: Revised code
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

+ 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. Slow response due to checkboxes in 2010
    By Kakkmaddafakka in forum Excel General
    Replies: 0
    Last Post: 07-31-2011, 05:12 PM
  2. Check that input in textbox is an integer
    By marcusr in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-26-2007, 01:01 PM
  3. [SOLVED] Integer only textbox?
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-02-2006, 11:05 AM
  4. [SOLVED] My command button has stopped functioning
    By E. Marsh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2005, 05:05 PM
  5. Button using Form, Iteration and Input values
    By coco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2005, 09:05 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