View Single Post
 
Old 03-04-2015, 02:24 PM
charlesdh charlesdh is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

Hi,

Here's a bit of code for filtering "Non Blank".
It will select the data in column G only.

Code:
Sub Filter_NonBank()
Application.ScreenUpdating = False
Dim Myval As Integer
Dim lrow As Long
lrow = Sheets("Bin inventory").Range("g65536").End(xlUp).Row
Selection.AutoFilter
Sheets("Bin inventory").Range("A1:h1").Select
Selection.AutoFilter
    With Selection
        .AutoFilter Field:=7, Criteria1:="<>" '' this set the filtered data for the value
    End With
    With Worksheets("Bin inventory").AutoFilter.Range
        Set VisRng = .Resize(.Rows.Count - 1, 1).Offset(1, 0) _
            .Cells.SpecialCells(xlCellTypeVisible)
            '' make sure you have more than 1 row  ''
        Myval = .Range("c2:c" & lrow).SpecialCells(xlCellTypeVisible).Count
        If Myval >= "2" Then
            Worksheets("Bin inventory").Range(Cells(VisRng.Offset(, 0).Row, 7), Cells(Range("g65536").End(xlUp).Row, 7)).Select
        End If
    End With
End Sub
Reply With Quote