mzafergazali
New Member
- Joined
- Apr 24, 2014
- Messages
- 2
Dear All
Please provide me macro to paste the value only visible cells in filtered recrods
Please provide me macro to paste the value only visible cells in filtered recrods
Sub FilterData()
Dim rng As Range
Dim rngVisible As Range
Set rng = Range("A1:G1000")
rng.AutoFilter Field:=1, Criteria1:=10
On Error Resume Next
Set rngVisible = GetFilterRange(rng).SpecialCells(xlCellTypeVisible)
If Not rngVisible Is Nothing Then
' Process visible cells here
End If
On Error GoTo 0
End Sub
Private Function GetFilterRange(rng As Range) As Range
With rng
Set GetFilterRange = .Offset(1).Resize(.Rows.Count)
End With
End Function