+ Reply to Thread
Results 1 to 4 of 4

how do i run a loop through 20 textboxes?

  1. #1
    Forum Contributor
    Join Date
    03-10-2017
    Location
    USA
    MS-Off Ver
    office 2016
    Posts
    393

    how do i run a loop through 20 textboxes?

    Currently I have code that changes values of 10 textboxs and I'd like to run through them as a loop instead of 10 lines of code. I plan on making it 20 textboxes and having 4 other conditions so i want to cut down on the length of code if possible. I cant seem to get it to accept my loop.

    Here is what I have that works in the long code

    Please Login or Register  to view this content.

    I've tried this but it wont accept it
    Please Login or Register  to view this content.
    I tried (textbox & i) and ("textbox" & i) but non work. I cant figure out the syntax

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: how do i run a loop through 20 textboxes?

    Hi kevinu,

    Please could you attach a sample workbook, since it contains a Userform (not a picture or pasted copy).
    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: how do i run a loop through 20 textboxes?

    Try

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Forum Contributor
    Join Date
    03-10-2017
    Location
    USA
    MS-Off Ver
    office 2016
    Posts
    393

    Re: how do i run a loop through 20 textboxes?

    That did the trick Mike. I didnt use .controls. thanks

+ 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: 5
    Last Post: 12-07-2016, 07:41 AM
  2. Loop through textboxes on a worksheet
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-03-2015, 04:12 PM
  3. [SOLVED] For Each Loop Works for Textboxes but Not for DTPickers.... why?
    By TheScott in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-03-2015, 06:01 AM
  4. Loop textboxes(activex)
    By sohaila in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2013, 05:18 AM
  5. [SOLVED] If then loop needed for Textboxes
    By minifreak in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-23-2012, 08:22 AM
  6. Loop into TextBoxes in an UserForm
    By pierre08 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-15-2010, 09:38 AM
  7. loop through the rows and then update the textboxes and captions
    By js999 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-02-2007, 10:52 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