LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default AutoFilter method of Range class failed

The first version of creating an autofilter in Excel works fine, but why do I
get an
exception on the second version?

I am coding in VB.NET (VB 2005).
(I would like to compile my code with option strict set to ON and then only
the second version does compile)

...
excelWorksheet.Activate()

' VERSION 1: the following 3 lines work fine
Dim range1 As Excel.Range = excelWorksheet.Range("A:A")
range1.Select()
excelWorksheet.Application.Selection.AutoFilter()


' VERSION 2: throws an Exceptions
Dim range2 As Excel.Range = CType(excelWorksheet.Range("B:B"),
Excel.Range)
range2.Select()
Dim rangeSel As Excel.Range =
CType(excelWorksheet.Application.Selection, Excel.Range)
rangeSel.AutoFilter() ' Exception: "AutoFilter method of Range
class failed"

Help would be appreciated!
 
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
AutoFilter method of Range class failed blopreste3180 Excel Programming 1 January 17th 06 10:40 PM
Autofilter method of range class failed Terry K Excel Programming 5 October 18th 05 03:09 AM
Insert method of range class failed quartz[_2_] Excel Programming 0 August 17th 04 07:31 PM
Insert method of range class failed DJH Excel Programming 0 August 17th 04 07:30 PM
AutoFilter method of Range Class Failed Randy Reese Excel Programming 3 April 3rd 04 04:34 AM


All times are GMT +1. The time now is 07:17 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"