Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
List values based on different values selected maniarasan Excel Discussion (Misc queries) 7 June 4th 10 02:12 PM
Finding Most Recent Values in Col1 -- Summing Matching Values Rothman Excel Discussion (Misc queries) 5 December 20th 07 08:19 PM
Fill a Listbox with Values from a Pivot Table Field - an Example DataFreakFromUtah Excel Programming 0 February 12th 04 04:12 PM
Accessing combobox/listbox values eggrock Excel Programming 1 December 9th 03 01:26 AM
Compare Listbox values with Collection values Stuart[_5_] Excel Programming 2 September 20th 03 01:58 PM


All times are GMT +1. The time now is 11:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"