View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.dotnet.languages.vb,microsoft.public.vb.ole.automation,microsoft.public.vb.ole
John Brock John Brock is offline
external usenet poster
 
Posts: 43
Default Can't create AutoFiltered Excel worksheet using VB.NET

In article ,
John Brock wrote:
[...]

It seemed strange to AutoFilter a range on a single worksheet by
doing something to the entire Application (which might have several
workbooks open), but it worked! Can anyone explain the logic to me?

In any case, the code looks like this:

Dim ws as Microsoft.Office.Interop.Excel.Worksheet
...

ws.Range("MyTableRange").Activate()
ws.Application.Selection.AutoFilter()

Also, does anybody have any idea what the AutoFilter function of
a Range object does (given that it doesn't turn AutoFiltering on)?


Of course...

ws.Range("MyTableRange").Select()
ws.Application.Selection.AutoFilter()

also works, and using Select/Selection looks a bit more harmonious.

What exactly is the difference between Select and Activate anyway?
--
John Brock