+ Reply to Thread
Results 1 to 6 of 6

Populating userform textboxes with specific record/row in excel worksheet

  1. #1
    Registered User
    Join Date
    10-09-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    16

    Populating userform textboxes with specific record/row in excel worksheet

    Hi all,

    Having designed a few basic userforms for input my employers have decided that i'm a VBA genius when in fact i'm self taught from a text book and google (god bless t'internet!).

    I have put together a basic userform for inputting information for a new project but am having trouble adding a function that allows users to amend existing records. The line of code that is causing me problems is as follows- Me("TextBox" & j).Text = Format(.List(.ListIndex, j))
    The whole section of code that it sits within is as follows ; (shamelessly cribbed and adapted from another source)

    Please Login or Register  to view this content.
    I'm fairly positive that the issue is something simple/stupid but i'm struggling to work it out. Here's hoping that you can help.

    Thanks

    Dan
    Attached Files Attached Files
    Last edited by arlu1201; 10-18-2012 at 01:25 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Populating userform textboxes with specific record/row in excel worksheet

    Dan

    I don't know if it's this simple but your textboxes are numbered starting from 1 not 0.

    So just replace j with j+1 where you are trying to refer to the textboxes in that code.
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Populating userform textboxes with specific record/row in excel worksheet

    danmack,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature below this post.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Registered User
    Join Date
    10-09-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Populating userform textboxes with specific record/row in excel worksheet

    Thanks Norie, as you'd already guessed it wasn't that simple but your insight has helped me fix the problem and added to my understanding of the code.

  5. #5
    Registered User
    Join Date
    10-09-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Populating userform textboxes with specific record/row in excel worksheet

    Ok, have read the rules properly now!

    Thanks

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646
    What else needed looked at?
    If posting code please use code tags, see here.

+ 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