Posts by rharri1972


    Is it possible to add height to the rows in a listbox?

    Not height to the listbox itself but to each individual row.

    Just like assigning the widths to each column in a multicolumn listbox with vba is there a way to add "padding" or space between each row in a listbox?

    If this is possible I would appreciate any coding help.



    Is it possible to open the same (userform1) with two different command buttons and get different results. The first button (INSERT) on (userform3)is to open the userform Cust_Line_Order_Form (with textboxes) in a blank value state.

    a button on this form then opens Userform Product Table.

    a command button (OK) on (userform Product Table) is to open the userform1 with values filled into the textboxes. A value selected from a listbox on userform Product Table, activates the value in a cell on a worksheet "INVENTORY".

    That value plus additional cell values are to show in USERFORM1 textboxes.

    So far it crashes.

    button 1 (INSERT):

    Code  '<-- opens form in blank value state...just a userform with blank textboxes

    commandbutton 2 on userform (Cust_Line_Order_Form)... opens userform (Product table) with a listbox of thousands of product... I hightlight product needed and hit "OK" command button that has this code:

    unload me

    In the userform_Activate() for userform Cust_Line_Order_Form

    I have code:

    Optionbutton1.visible=True '<--- has nothing to do with values
    me.textbox3.value = sheets("Inventory").activecell.value

    Once I can get this to work I plan to use the offset function to complete the other textboxes. However, It crashes.

    Obviously because I am trying to open the same userform in two different states but I can't figure out if there should be an (IF) statement or any other kind of "work around".

    I am basically trying to process a customers order. The Cust_Line_Order_Form will contain each line items values. Once the line items are entered, this form will go back to blank values waiting for the next line's values.

    Any help?

    sorry just saw your reply... been a very busy time for me.

    I just need the cell value that has been selected during the subroutine from clicking the command button to be the value that populates textbox14.

    the command button is on userform2

    textbox14 is on userform3.

    selected cell is found by the value in listbx listindex(0). the command button activates worksheet("customers"))...goes through range (A:A) until found, this is the code you suggested to me and it works perfect. Also in the code under the command button it opens my userform3 and upon initliazing I am needing textbox14 to be populated with the selected cells value. I have other textboxes as well but figured once i could figure this part out, i could have the others filled by using the offset.

    I hope this gives you enough insight.

    Thanks for any help.

    6stringJazzer... this works exaclty like I wanted it to! Thank you very much!

    Second part of this and I will try to be a little more specific.

    The command button executes the code you've provided. I just changed to suit my needs as far as the name of sheet...yaddi yadda.

    under the same command the end of this sub... This userform is my Customer Order Form

    On initialize I have:


    but nothing happens

    Background on this: Userform 1 is my Customer Activity Center

    The listbox has several customers in it. When a customer emails an order... i want to scroll through and find the customer to process the order for.

    These customers are identified within this database by their CUSTOMER ID which is the value of the listbox listindex(0) AND the cell value in range ("A") in the worksheet. I thought if someone helped me such as you have with the code to select the cell in range. Then it should be easy to have the cell value go to textbox14 but it has and is evading me. What I want to do is fill Textbox 14 with the value from range A, text box 15 with range B same row, etc., all the way to textbox19 referencing each value in columns A,B,C,D,E. Any help whatsoever? And again, thank you for taking the time for the help with the other code!!

    I do have half the answer to this post.

    I do now have the code that searches out the cell that has the value in it that matches listbox1 listindex(0).

    However, I thought it would be easy to state on my 2nd userform textbox14.text = the value of the active or selected cell but nothing i try works.

    in the 2nd userform initialize i have...

    me.textbox14.text = activecell.value    

    but nothing happens....

    I've also called out


    is there anyone that can help with this. As stated by the moderator this has been asked on MrExcel also.

    if it helps I can post the code that i have in place to activate or select the cell in the worksheet.

    Userform 2 with a listbox populated with several customers...I click or hightlight a customer...i click command button which activates worksheet ("Customers")... it finds the cell in range("A") that is the same as listbox1 listindex(0). The click of the button will also open Userform 3.

    in userform3 I have textbox14 that I want to equal the value in the selected cell.

    As always...any help will be greatly appreciated!!

    MODERATOR NOTICE: This topic has also been posted on other sites and may already have an answer elsewhere. Please take this into consideration when answering this question


    Hello! how can i code to have the value from userform1. listbox index (0) referenced and found in the active worksheet ("Customers") column "A" and then have column values from that row on the worksheet populate into textboxes when userform2 initializes? The listbox is on single select....

    on userform1. listbox is filled with several customers and multiple columns. Column 1 holds the ID number which is the reference to find in worksheet("Customers").

    So with this customer highlighted on userform1 I will click a command button "Insert Order" also on userform1 in which USERFORM2 will open, the click also activates worksheet ("Customers") and I would also like for this click to execute the code to find the selected listbox index value on the active worksheet and to pull the column values from that row to userform2....

    On userform2...

    textbox14 = worksheet "A".value

    textbox15 =worksheet "B".value

    textbox16 = worksheet "C".value

    textbox17 = worksheet "D".value

    textbox18 =worksheet "E".value

    textbox19 =worksheet "F".value

    Any help with showing how to code this will be greatly appreciated!!!