excel - Userforms with a listbox in VBA -


this first post on forum. have quick question regarding vba, userforms listbox. goal select 2 options , return list of names in listbox. have attached example userform , example table choosing from. appreciated.

worksheet

current vba userform

private sub listbox1_click()  sheets("trainers1").range("i2") = listbox1   end sub  private sub listbox2_click()  sheets("trainers1").range("i2") = listbox2   end sub  private sub listbox3_click()  sheets("trainers1").range("i3") = listbox3  end sub  private sub listbox4_change()  .listbox4 = sheets("trainers1").range("k2:k10")  end sub  private sub userform_initialize()  dim cnt dim cntr integer  cntr = application.worksheetfunction.counta(sheets("shift pattern key").range("a:a")) cnt = application.worksheetfunction.counta(sheets("training ratio").range("a:a"))  = 2 cntr   listbox2.additem sheets("shift pattern key").cells(i, 1)  next  i2 = 2 cnt  listbox3.additem sheets("training ratio").cells(i2, 1)  next i2  end sub 

you iterate through rows of table , compare values in each row values selected. if both values in row match values selected user can use .additem method add name of employee list.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

sql - MySQL - Finding Empty relations -

linux - gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now -