+ Reply to Thread
Results 1 to 8 of 8

Show Listbox row from a tab in Textboxes

  1. #1
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Show Listbox row from a tab in Textboxes

    Hi Forum.

    I had searched the net for a solution for hours, but couldn't find anything usable.
    I can transfer a Listbox row to the Textboxes, but not a row from another Tab, if more columns in the Tab then in the Listbox, should be transferred.
    And this is the problem.

    There is an explanation about my problem in the attached.

    I really hope to get some help with the code.
    And if possible, maybe to make the code in the workbook and re-attach the solution in the answer.

    Ps. I'm not a nerd in VBA, but use "Search and Use Codes" from the net

    Thank you in advance

    Kind regards
    Ib
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Show Listbox row from a tab in Textboxes

    Your Listbox is set to 6 columns

    In VBA
    Listbox1.Listcount = 12

    In The listbox properties window set the Listcount to 12

    You should also adjust the column widths to 40

    Also

    in the Command Button code you are only loading columns A to F. That should be "L"

    Please Login or Register  to view this content.

    To load the Textboxes from the Listbox you will need to add this code to the Listbox

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 01-13-2019 at 09:38 AM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Re: Show Listbox row from a tab in Textboxes

    Hi mehmetcik.

    I only want to show 6 columns in the Listbox.
    But fill in 12 columns with the Textboxes in the Tab.

    Actually there is 111 columns in each row all in all in the Tab.
    When inserting the 12 columns with the Textboxes in the next free row, the rest of the columns to DG: is calculating columns.

    When inserting the value from the 12 Textboxes I copy the calculating codes fra column 13 to 111 into the inserting row.
    It's copied from the row above and the first row, which contain the calculation code can't be deleted.

    I need to be able to edit the first 12 columns using the Textboxes, but only show the first 6 columns in the Listbox.

    I believe I can make a hidden Listbox2, containg the last 6 rows.
    And then fill in the 12 Textboxes with the value from Listbox1 and the hidden Listbox2.

    But it would be more fance to fill in the 12 Textboxes, directly from the Tab.
    Last edited by gnaske; 01-13-2019 at 09:54 AM.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Show Listbox row from a tab in Textboxes

    You will need to set Listbox1.columnscount to 12
    Then set your columns widths like this:-

    80 pt;80 pt;80 pt;80 pt;80 pt;80 pt;0 pt;0 pt;0 pt;0 pt;0 pt;0 pt

    The first 6 columns will be displayed, the last six will be hidden.


    To save the listboxes then you will need to add this code.
    If you click on the Edit button then
    a. If a listbox line is highlighted the data will be saved to that line
    b. If a listbox line is not highlighted then the data will be saved below your existing data.

    Please Login or Register  to view this content.

    Code for the "Insert Value" button:-

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 01-13-2019 at 10:27 AM.

  5. #5
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Re: Show Listbox row from a tab in Textboxes

    Hmm - Doesn't work.

    When marking a row in the Listbox, it doesn't insert the value into the Textboxes, to be edited.

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Show Listbox row from a tab in Textboxes

    Ok I have made a few changes for this.


    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Re: Show Listbox row from a tab in Textboxes

    Thank you - I'll test the code a little bit later.
    I need to go - Wife is calling
    But I'll be back

  8. #8
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010 and 2019, but only 2019 to test if my sheets works!
    Posts
    149

    Re: Show Listbox row from a tab in Textboxes

    I couldn't let it go, although the wife was screaming - Holy smoke

    My real workbook is about 25 Mb and it will destroy a lot in the other codes, if I try to implement your code into it.

    But I could use your suggestion about showing 12 rows in the Listbox.
    The column width was already set for the first 6 columns in the original Listbox and the only thing I needed to do, was to set the last 6 rows to 0pt
    Plus to change the range from J to L.

    I'll mean the problem is solved and I'll save your code too, because it can be useful another time.
    Thank you very very much.

    Test Workbook attached.

    Kind regards
    Ib
    Attached Files Attached Files

+ 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. populate textboxes from listbox dblClick
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-24-2017, 08:06 AM
  2. [SOLVED] Populating 12 textboxes from a Listbox
    By matrixpom in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-21-2016, 09:24 PM
  3. [SOLVED] Populate worksheet textboxes from listbox
    By rodgersmg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-11-2015, 01:25 AM
  4. Replies: 0
    Last Post: 02-04-2015, 03:46 PM
  5. [SOLVED] Populate textboxes from listbox.click
    By wingnut74 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-30-2013, 05:07 PM
  6. Listbox returning wrong value to textboxes !
    By Petter120 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-20-2012, 12:16 PM
  7. One ListBox & 3 TextBoxes
    By Rufus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-03-2010, 02:21 AM

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