List Box

  • Thread starter Thread starter Jahsonn
  • Start date Start date
J

Jahsonn

Hi Guys

Thanks for all your posts, I have now solved that Problem
but have now created another!!!! Blasted VB!!!

The Code Below should populate the list box with the
values created from the Worksheets but is coming up with
the error - Could not set the list property - Invalid
Property array index on the line .list = rng.value

This is only happens when the list only has 1 entry but I
cant figure out why its happening.

Thanks
 
Code as below

Private Sub UserForm_Initialize()
Dim rng As Range
Dim rw As Long, sh As Worksheet
Dim bStart As Boolean


rw = 17
For Each sh In ActiveWorkbook.Worksheets
If bStart Then
Worksheets("Control").Cells(rw, 2).Value = sh.Name
rw = rw + 1
End If
If sh.Name = Worksheets(4).Name Then bStart = True
Next


With Worksheets("Control")
Set rng = .Range(.Cells(17, 2), .Cells(Rows.Count, 2).End
(xlUp))
End With
With Me.ListBox1
...Clear
...List = rng.Value
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top