+ Reply to Thread
Results 1 to 3 of 3

Looping through userform textboxes using variables

  1. #1
    Registered User
    Join Date
    02-16-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    1

    Question Looping through userform textboxes using variables

    Scenario: Userform with 5 contact fields at the top made from textboxes (First, Last, Title, Phone, Email,) that I attempting to populate a 5x6 table below that I have created using textboxes (contact1,2,3...) on the same userform. I have a command button I would like to use to populate a contact row and clear the contact fields each time I fill the contact fields and press the button (fill contact fields, press button, populate row 1, fill contact fields, press button, populate row 2.... ). I think I need to incorporate a "control" variable, but I have been writing code now for 14hrs and my brain is not working at peak efficiency. Any help is greatly appreciated!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2016 (preparing to update to 2021)
    Posts
    7,544

    Re: Looping through userform textboxes using variables

    Hi, welcome to the forum
    You can address a Control by dimensioning as Control

    Me.Coontrols(Ctrl.Name & i (or j) or any numebr).Value (for textboxes and ComboBoxes), .Caption for OptionButtons, CheckBoxes and Labels

    Hope this helps (a little)


    Dim Ctrl As Control
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,613

    Re: Looping through userform textboxes using variables

    Attach a sample workbook. 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.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

+ 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. [SOLVED] Populating userform textboxes basis of results from 2 userform comboboxes
    By rlh in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-11-2017, 10:26 AM
  2. Help Populating Textboxes in Userform, With Multipage Userform.
    By mdmorgan24 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-07-2012, 05:29 PM
  3. Looping through TextBoxes
    By davidryder in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-16-2007, 11:31 PM
  4. forms: looping through multiple textboxes
    By nerp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2007, 07:50 PM
  5. Looping through textboxes
    By CLamar in forum Excel General
    Replies: 1
    Last Post: 07-12-2006, 11:40 AM
  6. [SOLVED] Userform Textboxes and Looping
    By Robbyn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-17-2005, 12:06 AM
  7. Looping thru Textboxes
    By zac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-25-2005, 05:43 PM

Tags for this Thread

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