Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill values into a listbox matching selected values from a combobox
Hi I have 2 worksheets (musclegroup and exercise) I loop in the values from musclegroup into a combobox, the combobox listindex is the same as the ID(A). Now I want to fill up the exercises(column B in worksheet exercise) into the frmExercise.lstExercise that correspond to the musclegroup I select in frmExercise.cboMusclegroup. Is there a simply way Regards Jon Follow the link below, explains and shows the userform and worksheets http://www.johak.se/index.html |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill values into a listbox matching selected values from a combobox
Jon,
I think this is what you want Private Sub cboMusclegroup_Click() frmExercise.lblMuscleGroupID.Caption = frmExercise.cboMusclegroup.ListIndex ' Dim WS As Worksheet Dim WSRow As Long Dim i As Long ' frmExercise.lstExercise.Clear ' Set WS = Application.ActiveWorkbook.Worksheets("exercise") ' 'Finds the last row in column B containing a value WSRow = WS.Cells(Cells.Rows.Count, "B").End(xlUp).Row Me.lstExercise.Clear For i = 1 To WSRow If WS.Cells(i, "C").Value = Me.cboMusclegroup.Value Then lstExercise.AddItem WS.Cells(i, "B") End If Next i If Me.lstExercise.ListCount 0 Then Me.lstExercise.ListIndex = 0 End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Jon" wrote in message ... Hi I have 2 worksheets (musclegroup and exercise) I loop in the values from musclegroup into a combobox, the combobox listindex is the same as the ID(A). Now I want to fill up the exercises(column B in worksheet exercise) into the frmExercise.lstExercise that correspond to the musclegroup I select in frmExercise.cboMusclegroup. Is there a simply way Regards Jon Follow the link below, explains and shows the userform and worksheets http://www.johak.se/index.html |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill values into a listbox matching selected values from a combobox
Private Sub cboMuscleGroup_Click()
frmExcercise.lstExercise.Clear for each cell in worksheets("Exercise").Range("A1:A10) if cell.Value = frmExcercise.cboMuscleGroup.Value then frmExcercise.lstExercise.AddItem cell.offset(0,1) end if Next End Sub Assumes A1:B10 is a list with musclegroup in column A and exercise in column B -- Regards, Tom Ogilvy "Jon" wrote in message ... Hi I have 2 worksheets (musclegroup and exercise) I loop in the values from musclegroup into a combobox, the combobox listindex is the same as the ID(A). Now I want to fill up the exercises(column B in worksheet exercise) into the frmExercise.lstExercise that correspond to the musclegroup I select in frmExercise.cboMusclegroup. Is there a simply way Regards Jon Follow the link below, explains and shows the userform and worksheets http://www.johak.se/index.html |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill values into a listbox matching selected values from a combobox
Jon wrote:
Hi I have 2 worksheets (musclegroup and exercise) I loop in the values from musclegroup into a combobox, the combobox listindex is the same as the ID(A). Now I want to fill up the exercises(column B in worksheet exercise) into the frmExercise.lstExercise that correspond to the musclegroup I select in frmExercise.cboMusclegroup. Is there a simply way Regards Jon Follow the link below, explains and shows the userform and worksheets http://www.johak.se/index.html Thanks Guys Works perfectly |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill values into a listbox matching selected values from a combobox
Didn't see your link at the bottom of the message, or mine might have been
more tailored. -- Regards, Tom Ogilvy "Jon" wrote in message ... Jon wrote: Hi I have 2 worksheets (musclegroup and exercise) I loop in the values from musclegroup into a combobox, the combobox listindex is the same as the ID(A). Now I want to fill up the exercises(column B in worksheet exercise) into the frmExercise.lstExercise that correspond to the musclegroup I select in frmExercise.cboMusclegroup. Is there a simply way Regards Jon Follow the link below, explains and shows the userform and worksheets http://www.johak.se/index.html Thanks Guys Works perfectly |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
List values based on different values selected | Excel Discussion (Misc queries) | |||
Finding Most Recent Values in Col1 -- Summing Matching Values | Excel Discussion (Misc queries) | |||
Fill a Listbox with Values from a Pivot Table Field - an Example | Excel Programming | |||
Accessing combobox/listbox values | Excel Programming | |||
Compare Listbox values with Collection values | Excel Programming |