Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default AutoFilter _FilterDatabase Rowsource Listbox

RowSource is looking for a string (the range address as a string), not a
range object. check out the example in Help.

--
Jim Rech
Excel MVP
"hgdev" wrote in message
om...
| Excel 2000
|
| I am trying to get AutoFilter data into a ListBox.
| The below code gives me an "Type mismatch" error when I try to add the
| Listbox Rowsource line. I read about using _FilterDatabase but could
| not get the right syntax.
|
| Private Sub UserForm_Initialize()
| Dim myVisibleRng As Range
| Dim myFilterRng As Range
| Set myFilterRange = Sheet1.Range("a1:e13000")
| myFilterRange.AutoFilter Field:=5, Criteria1:="18650"
| Set myVisibleRange = myFilterRange.SpecialCells(xlCellTypeVisible)
| Debug.Print myVisibleRange.Address
| ListBox1.RowSource = myVisibleRange '<--type mismatch
| End Sub
|
|
| Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default AutoFilter _FilterDatabase Rowsource Listbox

Ok. Thanks for response.
I see that now in Help; object.RowSource[=String]

It has taken me hours to get this far.
How do I turn/convert the Range Object output into a string to satisfy
the .RowSource?


"Jim Rech" wrote in message ...
RowSource is looking for a string (the range address as a string), not a
range object. check out the example in Help.

--
Jim Rech
Excel MVP
"hgdev" wrote in message
om...
| Excel 2000
|
| I am trying to get AutoFilter data into a ListBox.
| The below code gives me an "Type mismatch" error when I try to add the
| Listbox Rowsource line. I read about using _FilterDatabase but could
| not get the right syntax.
|
| Private Sub UserForm_Initialize()
| Dim myVisibleRng As Range
| Dim myFilterRng As Range
| Set myFilterRange = Sheet1.Range("a1:e13000")
| myFilterRange.AutoFilter Field:=5, Criteria1:="18650"
| Set myVisibleRange = myFilterRange.SpecialCells(xlCellTypeVisible)
| Debug.Print myVisibleRange.Address
| ListBox1.RowSource = myVisibleRange '<--type mismatch
| End Sub
|
|
| Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default AutoFilter _FilterDatabase Rowsource Listbox

set rng = Range("A1:A10")
Listbox1.Rowsource = rng.Address(external:=True)

--
Regards,
Tom Ogilvy

"hgdev" wrote in message
om...
Ok. Thanks for response.
I see that now in Help; object.RowSource[=String]

It has taken me hours to get this far.
How do I turn/convert the Range Object output into a string to satisfy
the .RowSource?


"Jim Rech" wrote in message

...
RowSource is looking for a string (the range address as a string), not a
range object. check out the example in Help.

--
Jim Rech
Excel MVP
"hgdev" wrote in message
om...
| Excel 2000
|
| I am trying to get AutoFilter data into a ListBox.
| The below code gives me an "Type mismatch" error when I try to add the
| Listbox Rowsource line. I read about using _FilterDatabase but could
| not get the right syntax.
|
| Private Sub UserForm_Initialize()
| Dim myVisibleRng As Range
| Dim myFilterRng As Range
| Set myFilterRange = Sheet1.Range("a1:e13000")
| myFilterRange.AutoFilter Field:=5, Criteria1:="18650"
| Set myVisibleRange = myFilterRange.SpecialCells(xlCellTypeVisible)
| Debug.Print myVisibleRange.Address
| ListBox1.RowSource = myVisibleRange '<--type mismatch
| End Sub
|
|
| Thanks.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
???Help??? Userform.Listbox.rowsource = ??? Steve Sparti Excel Discussion (Misc queries) 0 March 1st 06 09:44 PM
RowSource in ListBox aet-inc[_2_] Excel Programming 1 December 3rd 03 12:41 AM
ListBox Rowsource Limitation?? Dave Baranas Excel Programming 2 September 29th 03 05:01 PM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM
listbox rowsource Christy[_2_] Excel Programming 4 September 20th 03 11:44 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"