Results 1 to 3 of 3

auto filter macro, select columns

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-15-2011
    Location
    Whitby, Canada
    MS-Off Ver
    Excel 2010
    Posts
    121

    auto filter macro, select columns

    Hi ya'll,

    I have a macro that I am using to filer a spreadsheet to only show rows and columns that have numbers in them. I would like to tweak this somewhat to allow me to show/hide different columns (or run the 'alternate' show/hide column macro first to get the right columns available and then run my existing macro to filer remaining rows and columns?).
    I would like a macro to do this, perhaps with a pop up window asking which columns to show/hide (ie. A:C, L:N, P) - something like that - and the reason why I want a macro for it, as opposed to doing it manually is that other users with only very basic skills will be using the sheets to pull reports and only want to see certain columns per report....if anyone has any better ideas, I'm all for that too...TIA, workbook attached.

    Sub test()
    
    Dim frange As Range, numb_in As Range
    
    On Error Resume Next
    
    Set frange = Application.InputBox(Prompt:="Range to filter selection - Type 'C4:AH120'", Title:="Select your range to filter", Type:=8)
    
    If frange Is Nothing Then
    
        Exit Sub
    
    Else
     
        Application.ScreenUpdating = 0
        
        frange.Replace 0, "", xlWhole
        
        Set numb_in = frange.SpecialCells(xlCellTypeConstants)
        
        With frange.SpecialCells(xlCellTypeBlanks)
        
            .EntireRow.Hidden = True
            .EntireColumn.Hidden = True
            
        End With
        
        With numb_in
        
            .EntireRow.Hidden = False
            .EntireColumn.Hidden = False
        
        End With
        
        frange.Replace "", 0, xlWhole
        
        Application.ScreenUpdating = 1
        
    End If
    
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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