+ Reply to Thread
Results 1 to 4 of 4

VBA userform to do add a value into a table? For a combo box?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-29-2017
    Location
    London England
    MS-Off Ver
    2016
    Posts
    194

    VBA userform to do add a value into a table? For a combo box?

    Hi all,

    This should be simple, but I can't really put it together, my brain doesn't function today..

    I have a Userform with a text box, and it copies a template from Sheet1 into Sheet2, and inputs the value of the textbox into the pasted template's name cell on Sheet2, every time I press this button, a new section is to be added to Sheet2, below the previous one with a different name, but I would also like it to input these names, into a table on Sheet1.

    At least.. I think thats what I want. The plan is, to then create another Userform, which will have a drop down list created from this table, or is it better if its not a table just a named range? I just want it to be dynamic, it is just 1 column.

    If its best to do the table how do I do this line?

    SG_Names_LR = Sheet1.ListObjects("Table1").Range.Rows.Count
    
    Sheet1.Cells(SG_Names_LR + 1, 1).Value = Name_SG_Textbox.Value
    As currently it adds the new name under the (manually created) table, not into it.

    Or is it supposed to be something like - If this is the first item in this range, then create a table called Table1, otherwise add a row? Or how?

    Please help!

  2. #2
    Forum Contributor
    Join Date
    05-12-2018
    Location
    Netherlands
    MS-Off Ver
    2016
    Posts
    266

    Re: VBA userform to do add a value into a table? For a combo box?

    try this:

    Sheet1.ListObjects("Table1").ListRows.Add.Range(1) = Name_SG_Textbox.Value

  3. #3
    Forum Contributor
    Join Date
    08-29-2017
    Location
    London England
    MS-Off Ver
    2016
    Posts
    194

    Re: VBA userform to do add a value into a table? For a combo box?

    Oh amazing! Thank you!!

  4. #4
    Forum Contributor
    Join Date
    05-12-2018
    Location
    Netherlands
    MS-Off Ver
    2016
    Posts
    266

    Re: VBA userform to do add a value into a table? For a combo box?

    You're welcome

+ 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. Help me regarding userform combo box update from Range table
    By mebro in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-10-2018, 12:34 AM
  2. VBA Userform combo box - need to enable user to add new item if not listed in combo box
    By theshybutterfly in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-14-2015, 07:25 PM
  3. Userform with dependent combo/text boxes that then update table
    By Plane Fixer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-04-2014, 08:23 AM
  4. Combo Box Userform To Open 2nd Combo Box
    By WPJensen in forum Excel General
    Replies: 8
    Last Post: 03-10-2011, 06:33 AM
  5. Help with userform (trying to read data from table into combo list)
    By EK1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-05-2010, 10:18 AM
  6. Combo Box up in the userform
    By koda86 in forum Excel General
    Replies: 2
    Last Post: 06-19-2007, 06:27 AM
  7. Userform combo box
    By Andy the yeti in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-27-2006, 03:10 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