View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default Variable List Box Range

Your code worked ok for me.

With Sheets(g_Country)
.ListBox1.ListFillRange = ""
.ListBox1.List = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp)).Value
End With

(I did have to insert dots in front of the .listbox1.listfillrange and
..listbox1.list lines, though.)

You sure you have a listbox from the control toolbox toolbar on that g_Country
worksheet?

peter_rivera wrote:

Hi Dave, this is the code:

Private Sub Listbox1_Change()

With Sheets(g_Country)
ListBox1.ListFillRange = ""
ListBox1.List = .Range("a1", .Cells(.Rows.Count,
"A").End(xlUp)).Value
End With

Dim rng As Range
Set rng = Range(ListBox1.RowSource).Columns(1).Cells
Set rng = rng(ListBox1.ListIndex + 1)

Dim rng As Range
Set rng = Range(ListBox1.RowSource).Columns(1).Cells
Set rng = rng(ListBox1.ListIndex + 1)
Let text1.Text = rng.Text
Let text2.Text = rng.Offset(0, 1).Text
etc....

However, everytime this is run I get an error 438 as ListFillRange is
not supported.
How do I correct this? Thanks!!

--
peter_rivera
------------------------------------------------------------------------
peter_rivera's Profile: http://www.excelforum.com/member.php...o&userid=24495
View this thread: http://www.excelforum.com/showthread...hreadid=381591


--

Dave Peterson