Results 1 to 2 of 2

Thread: populating results into text boxs from various comboboxs in a form

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2013
    Posts
    10

    populating results into text boxs from various comboboxs in a form

    Hello All,

    I am totally new to excel form. I have basically created 4 combo boxs which picks up values from the columns in the different excel workbook from sheet 2 and sheet 3.

    Basically I want to populate values when all the four columns are selected in my text boxs below. that means it is basically a simple filter criteria when all the four columns are selected in excel I want the result to be shown in my textboxs when the user clicks on a button pop up details in my form.

    Please help me with the vb code on this one.

    basically I have coded this code below under userform initialize event

    With Worksheets("Sheet2")
    ComboBox1.List = .Range("C2:C" & .Range("C" & .Rows.Count).End(xlUp).Row).Value
    ComboBox2.List = .Range("BM2:BM" & .Range("BM" & .Rows.Count).End(xlUp).Row).Value
    End With

    With Worksheets("Sheet3")
    ComboBox3.List = .Range("P3:P" & .Range("P" & .Rows.Count).End(xlUp).Row).Value
    ComboBox4.List = .Range("K3:K" & .Range("K" & .Rows.Count).End(xlUp).Row).Value
    End With

    help me fill in the values for the textboxs txtbox5, txtbox6 and txtbox 7 whose values should come from column H, S AND AL from sheet 3, once the condition is satisfied.

  2. #2
    New Member
    Join Date
    Apr 2013
    Posts
    7

    Re: populating results into text boxs from various comboboxs in a form

    sth like this? not sure what what supposed to go in which textbox there but you get the point...


    Code:
    Private Sub ckMyCbos_fillTbo()
    If ComboBox1.SelText<>"" and ComboBox2.SelText<>"" and ComboBox3.SelText<> and ComboBox4.SelText<>"" then
    Textbox1.text= ComboBox1.SelText
    TextBox2.text= ComboBox2.SelText  
    TextBox2.text= ComboBox3.SelText 
    TextBox4.text =ComboBox4.SelText 
    End if
    End Sub
    
    Private Sub ComboBox1_Change()
    ckMyCbos_fillTbo
    End Sub
    Private Sub ComboBox2_Change()
    ckMyCbos_fillTbo
    End Sub
    Private Sub ComboBox3_Change()
    ckMyCbos_fillTbo
    End Sub
    Private Sub ComboBox4_Change()
    ckMyCbos_fillTbo
    End Sub

    hth

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width