ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   list property of listbox (https://www.excelbanter.com/excel-programming/351002-list-property-listbox.html)

x taol

list property of listbox
 


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 ***

Dave Peterson

list property of listbox
 
If rng.Cells.Count 1 Then
lis.List = rng.Value
Else
lis.List = Array(rng.Value)
End If



x taol wrote:

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 ***


--

Dave Peterson

x taol

list property of listbox
 

please is it possible making with one syntex without if statement?

for example

lst.List = ~~~~

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

Dave Peterson

list property of listbox
 
isn't .list expecting an array?



x taol wrote:

please is it possible making with one syntex without if statement?

for example

lst.List = ~~~~

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


--

Dave Peterson


All times are GMT +1. The time now is 08:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com