+ Reply to Thread
Results 1 to 2 of 2

print filtered columns

Hybrid View

  1. #1
    Registered User
    Join Date
    04-07-2008
    Posts
    30

    print filtered columns

    Hi,
    I need to filter one column at a time for non-blanks, then print the results, and repeat for the next 50+ columns....I have the following manual codes:

    
    Sub PrintNonBlanks()
    
        Range("B3").Select
        Selection.AutoFilter Field:=2, Criteria1:="<>"
        ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate _:=True
        Range("B3").Select
        Selection.AutoFilter Field:=2
    
        Range("C3").Select
        Selection.AutoFilter Field:=3, Criteria1:="<>"
        ActiveWindow.SelectedSheets.PrintOut From:=2, To:=2, Copies:=1, Collate _:=True
        Selection.AutoFilter Field:=3
    
    ....
    
    End Sub

    Is there a way to loop this with better codes, so it can start at cell B3 to BD3, page 1-55 (without me repeating the codes for 50+ times?)?

    Thanks in advance for your help.
    Last edited by tn80; 11-20-2008 at 07:54 PM.

  2. #2
    Registered User
    Join Date
    04-07-2008
    Posts
    30
    I was able to solve this myself with the following codes... :D

    Sub PrintNonBlank()
        
        Dim Client As Long
        
        For Client = 2 To 55
            Selection.AutoFilter Field:=Client, Criteria1:="<>"
            ActiveWindow.SelectedSheets.PrintOut From:=Client - 1, To:=Client - 1, Copies:=1, Collate _
                :=True
            Selection.AutoFilter Field:=Client
        Next Client
    End Sub

+ 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