+ Reply to Thread
Results 1 to 7 of 7

Reading data from many TextBoxes in UserForm

  1. #1
    Registered User
    Join Date
    11-25-2008
    Location
    Poland
    Posts
    25

    Reading data from many TextBoxes in UserForm

    Hello. Again I need your irreplaceable help.

    I've just created a form with 20x20 textboxes ( Some kind of matrix ).
    It is here :
    form.jpg

    And what is more I have created an variable(array), where I will store data inserted into TextBoxes by a user of my Macro.

    I would like to know (if it is possible) how to automate reading data from TextBoxes and putting it into array in macro code? I hope I explained my request in a clear way.

    My TextBoxes names are for example TextBox11 for a TextBox in verse nr.1 and column nr.1.

    Greetings, Adam
    Last edited by adashiu; 11-28-2008 at 09:26 PM.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    In this example, I filled an array for textbox and combobox controls. If you have other textbox controls that you don't want to add, then use the Tag property and check it or:
    Please Login or Register  to view this content.
    TextBox would be your prefix name and 7 is the length of the prefix. This If goes after the Case "TextBox" below.

    Put this into the top of a Module:
    Please Login or Register  to view this content.
    In the Userform:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-25-2008
    Location
    Poland
    Posts
    25
    Your example seems to be a bit too complicated for me ;/ and it does not work.
    Could you attach your example file?

    I want to ask you moreover, how to such a thing :

    I declare a variable (eg. i)
    I create a loop

    For i=1 to 5
    ///// and here I dont know how to type a name of TextBox+ variable i
    (for example i=1 then the name is TextBox1)

    Thanks for your time, Adam

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    Given your naming convention how do you tell text box Row1 column11 from Row11 column1?

    Textbox111 and Textbox111

    As you will not be allowed 2 controls with the same name what are your controls called?

    It would be easier if you posted your example rather than making us create a userform and naming 400 controls, which I assume you have already done.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    Sorry, the first method was to make a control array.

    To use these examples, add Userform1, 15 Textbox and 2 commandbutton controls. I show 2 methods to do it with the code below. Doubleclick Userform1 and add this code.

    Fill the textboxes and then push one of the 2 buttons to show the results in a MsgBox.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    11-25-2008
    Location
    Poland
    Posts
    25
    Afff.... Ive done it. Thank you for your help, Mates

    Thanks again, Adam

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by adashiu View Post
    Afff.... Ive done it. Thank you for your help, Mates

    Thanks again, Adam
    Please mark he Thread Solved & rate he answer(s)
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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