Excel VBA + Return multiple rows in TextBox based on values in ComboBox -
i writing vba code in excel accomplish getting multiple rows textbox based on values selected in combobox. following code have written. listing me last row not rows have. ex. column 76 combobox show values. if values match should return me in textbox values found in column 77. i.e., if select in combobox bfsi, should return me lic of india & sbi. code returns sbi.
private sub combobox22_change() 'variable declaration dim irow, startline, endline integer endline = 50 irow = 6 'clear combobox2 before loading items textbox21.text = "" startline = 1 endline if combobox22.text = sheets("pivots").cells(irow, 76) textbox21.text = sheets("pivots").cells(irow, 77) end if irow = irow + 1 next startline end sub
yes, code that. problem when gets second "bfsi" cell, overwrite first item column 77 instead of appending it. change line
textbox21.text = sheets("pivots").cells(irow, 77)
to
textbox21.text = textbox21.text & "&" & sheets("pivots").cells(irow, 77)
the values column 77 appended textbox value. in example, separated &
symbol, adapt match needs.
Comments
Post a Comment