kpmsivaprakasam2003
New Member
- Joined
- Jan 28, 2020
- Messages
- 14
- Office Version
- 365
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
- Platform
- Windows
Hi,
I am working Excel 2013,
I need the Autofilter "#N/A" in the "F" column, if filter the "#N/A" no data with the heading, "Goto 0:" code does...
but, my code not working, goto 0:
Sub testsss()
'Filter Insert and #N/A Copy and Paste
'VBA – Turn Off Autofilter From Code
If ActiveSheet.AutoFilterMode Then
ActiveSheet.AutoFilterMode = False 'ActiveSheet.Range("A1").AutoFilter ---> Turn On Autofilter
End If
'Auto Filter 2nd Column Blank Cells filter
Dim LastRow As Long
LastRow = Range("B" & Rows.Count).End(xlUp).Row
On Error Resume Next 'if filter then no data go next
ActiveSheet.Range("$A$1:$F" & LastRow).AutoFilter Field:=6, Criteria1:="#N/A" 'Not Applicable Cells filter then select visible cells
Range("$A$2:$F" & LastRow).SpecialCells(xlCellTypeVisible).Select
'Stop copy paste if the filtered range has no data
If Range("A1:F" & LastRow).SpecialCells(xlCellTypeVisible).Count > 1 Then
Range("$B$2:$D" & LastRow).SpecialCells(xlCellTypeVisible).Select
Selection.Copy
'Do Something Code.........
Application.CutCopyMode = False
Else
ActiveSheet.AutoFilterMode = False
GoTo 0:
End If
'Do Something Code.........
0:
End Sub
Kindly help me, thanks for advance
I am working Excel 2013,
I need the Autofilter "#N/A" in the "F" column, if filter the "#N/A" no data with the heading, "Goto 0:" code does...
but, my code not working, goto 0:
Sub testsss()
'Filter Insert and #N/A Copy and Paste
'VBA – Turn Off Autofilter From Code
If ActiveSheet.AutoFilterMode Then
ActiveSheet.AutoFilterMode = False 'ActiveSheet.Range("A1").AutoFilter ---> Turn On Autofilter
End If
'Auto Filter 2nd Column Blank Cells filter
Dim LastRow As Long
LastRow = Range("B" & Rows.Count).End(xlUp).Row
On Error Resume Next 'if filter then no data go next
ActiveSheet.Range("$A$1:$F" & LastRow).AutoFilter Field:=6, Criteria1:="#N/A" 'Not Applicable Cells filter then select visible cells
Range("$A$2:$F" & LastRow).SpecialCells(xlCellTypeVisible).Select
'Stop copy paste if the filtered range has no data
If Range("A1:F" & LastRow).SpecialCells(xlCellTypeVisible).Count > 1 Then
Range("$B$2:$D" & LastRow).SpecialCells(xlCellTypeVisible).Select
Selection.Copy
'Do Something Code.........
Application.CutCopyMode = False
Else
ActiveSheet.AutoFilterMode = False
GoTo 0:
End If
'Do Something Code.........
0:
End Sub
Kindly help me, thanks for advance