list property of listbox

X

x taol

please see the code below



sub btn_click()
'lis == listbox control in userform
set rng = range("a2:a5")
lis.list=rng.value 'it's ok
set rng = range("a2")
lis.list = rng.value 'it' not ok

'how can i ??
'i don't want to use "additem".



end sub

*** Sent via Developersdex http://www.developersdex.com ***
 
D

Dave Peterson

If rng.Cells.Count > 1 Then
lis.List = rng.Value
Else
lis.List = Array(rng.Value)
End If
 

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

Top