Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to populate list box on another sheet getting runtime error 13 Type mismatch

Status
Not open for further replies.

vba__6229

Programmer
Mar 24, 2017
3
US
Hello,
I have two worksheets. One sheet has my list boxes on it and the other sheet has my data in it. I am trying to populate my second list box based on values that I clicked on from the first list box. I am getting a run time error 13 Type mismatch. Sheet 1 is called Input, second sheet is called PracticeNames. The name of my first listbox is lstWave, the name of my second listbox is lstPractices. My goal is to list all the text within a range depending on the input. I am starting with Range 1 that is defined as B2:B6


Code:
Private Sub lstPractices_Click()

Dim ws As Worksheet
Dim lRow As Long

Set ws = Worksheets("PracticeNames")

lRow = ws.Range("B" & Rows.Count).End(xlUp).Row

If lstWave.Value = 1 Then lstPractices.Value = Worksheets("PracticeNames").Range("B2:B6").Value 'Runtime Error 13 Type mismatch

End Sub
 
Hi,

This code to load a range does not make sense. You don't use the Listbox_Click event to load list data. You could use the click event on some OTHER ListBox, for instance.

So this might work. Name your ranges on PracticeNamed, List1, List2...etc.
Code:
Private Sub lstWave_Click()
    lstPractices.ListFillRange = "List" & latWave.Value
End Sub


Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Skip,
Thanks for the help. This fixed the issue. Have a great day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top