I only have 1 sheet named Not-Covered-Time, my goal is to copy the details from the Not-Covered-Time into other sheet and only copy rows base on the cell value "0" that is located in Column T (T1).
Sub fastRowDelete()
'@IgnoreModule
Dim orig As Worksheet
Dim name_switch As String
Dim output As Worksheet
Dim count_col As Long
Dim count_row As Long
Set orig = ActiveSheet
name_switch = orig.Name
If orig.Name = "Not-Covered-Time" Then
orig.Name = "Not-Covered-Time1"
Else
orig.Name = "Not-Covered-Time"
End If
Sheets.Add.Name = name_switch
Set output = Sheets(name_switch)
orig.Activate
count_col = WorksheetFunction.CountA(Range("A1", Range("A1").End(xlToRight)))
count_row = WorksheetFunction.CountA(Range("A1", Range("A1").End(xlDown)))
' filter
ActiveSheet.Range("A1").AutoFilter Field:=20, Criteria1:="0"
' Copy data over
orig.Range(orig.Cells(1, 1), orig.Cells(count_row, count_col)). _
SpecialCells(xlCellTypeVisible).Copy
output.Cells(1, 1).PasteSpecial xlPasteValues
Application.CutCopyMode = False
orig.ShowAllData
orig.AutoFilterMode = False
'delete original sheet
Application.DisplayAlerts = False
orig.Delete
Application.DisplayAlerts = True
output.Activate
ActiveSheet.Range("A1").Select
End Sub
A reply is very much appreciated. Thank you!
Have tried everything and the code looks exactly right but there's something going on that causes the error application defined or object error 1004