+ Reply to Thread
Results 1 to 5 of 5

Userform: How do I use text/values from a spreadsheet to customize the userform?

  1. #1
    Registered User
    Join Date
    07-29-2013
    Location
    California, United States
    MS-Off Ver
    Excel 2010
    Posts
    49

    Userform: How do I use text/values from a spreadsheet to customize the userform?

    Let's say that the userform I created has a textbox called "TextBox1". In my worksheet1, there is a name "Jackson" in Cells(1,1). Using VBA, how do I add that "Jackson" into the "TextBox1"?

    Please Login or Register  to view this content.
    I want to do the same thing with ListBoxes. Eventually, I plan to expand and add a loop to insert a list of values into the listboxes and textboxes.
    Last edited by bananajelly; 05-14-2014 at 12:48 PM.

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

    Re: Userform: How do I use text/values from a spreadsheet to customize the userform?

    The code looks fine, it should put the value from Cells(1,1) on Sheet1 in TextBox1.

    Are you having problems with it?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    07-29-2013
    Location
    California, United States
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Userform: How do I use text/values from a spreadsheet to customize the userform?

    I get a "Run-time error '424': Object required."

    Please Login or Register  to view this content.
    This is for the command button. The debug states that the "IngLotNums.Show" is the problem. That's the name of my userform: IngLotNums. When I delete the Private Sub UserForm_Initialize, the UserForm shows up, so I think the problem lies in the code for the UserForm Initialize.

    And yes, there is text in Cells(2,4).

    Please Login or Register  to view this content.

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

    Re: Userform: How do I use text/values from a spreadsheet to customize the userform?

    That's completely different code.

    In the first code you set worksheet1 to refer to the worksheet 'Worksheet1' then use it to put the value in the textbox, in this code you set Form to refer to the worksheet 'magic', so that's what you should use in the rest of the code.

    Try this.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-29-2013
    Location
    California, United States
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Userform: How do I use text/values from a spreadsheet to customize the userform?

    Okay. I see my mistake. I wrote magic.Cells instead of Form.Cells. It works now. Thanks! So you can customize UserForm from values within the spreadsheet. That's cool.

+ 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. Linking values on spreadsheet to userform and editing it
    By Tingster013 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-26-2014, 12:14 PM
  2. [SOLVED] Changed userform combobox to listbox, unable to get userform to retrieve datasheet values
    By dragonabsurdum in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2013, 01:38 PM
  3. How to customize a userform
    By punna111 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-11-2013, 02:01 PM
  4. How to wrap text for a spreadsheet in Userform.
    By shals in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-07-2012, 11:49 AM
  5. Showing Spreadsheet values on a userform
    By jamie.rowland@shell.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-04-2006, 10:05 AM

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