+ Reply to Thread
Results 1 to 2 of 2

Applying autofilter via VBA Not working

  1. #1
    Registered User
    Join Date
    04-29-2005
    Posts
    6

    Applying autofilter via VBA Not working

    I have the following code (Run from MS Access 2003 -- Early Binding):

    <Snipped unneeded code>

    Dim objXL as New Excel.Application
    with objXL

    <Snipped unneeded code>

    If fEmail Then

    'Delete Status Column
    .Range("A7").Select
    .Selection.AutoFilter
    .Columns("N:N").Select
    .Selection.Delete Shift:=xlToLeft
    .Range("A7:M7").Select
    .Selection.AutoFilter

    'Filter on Open Items:
    .Range("A7:M7").Select
    .Selection.AutoFilter Field:=11, Criteria1:="No"

    'Filter for specified PosterLoc:
    If Not IsMissing(strPosterLoc) Then
    .Range("A7:M7").Select
    .Selection.AutoFilter Field:=8, Criteria1:=strPosterLoc
    End If
    End If

    When I go into the excel application, the dropdown filters are blue and have the correct filter turned on. However only the first row is filtered.

    Any ideas?

  2. #2
    Registered User
    Join Date
    04-29-2005
    Posts
    6
    Boy, don't I fell stupid!

    I figured it out -- This code was running after the filter code:

    'Add 12 Points to each Detail line RowHeigt -- Explanations are being cutoff:
    .Range("A8").Select
    .ActiveCell.Offset(1, 0).Select
    .ActiveCell.RowHeight = .ActiveCell.RowHeight + 12
    Do While Not IsEmpty(.ActiveCell)
    .ActiveCell.Offset(1, 0).Select
    .ActiveCell.RowHeight = .ActiveCell.RowHeight + 12
    Loop
    .ActiveCell.RowHeight = .ActiveCell.RowHeight - 12 'Last row does not need to be done!
    .Range("A8").Select

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1