Hi Team,
I am getting an error if there is no data for the filtered values. Please look in to the code and help me to resolve the error. If there is no data it needs to continue with next steps.
Please find the code below
>>> use code - tags <<<
I am getting an error if there is no data for the filtered values. Please look in to the code and help me to resolve the error. If there is no data it needs to continue with next steps.
Please find the code below
>>> use code - tags <<<
Code:
Sub Copy_Filtered_data_Raw()
Dim Count_Col, Count_Row As Integer
Dim Raw, Modified As Worksheet
Dim lDestLastRow2 As Long
Worksheets("Modified").Activate
Set Modified = ThisWorkbook.Sheets("Modified")
Set Raw = ThisWorkbook.Sheets("Raw")
Count_Col = WorksheetFunction.CountA(Range("A1", Range("A1").End(xlToRight)))
Count_Row = WorksheetFunction.CountA(Range("A1", Range("A1").End(xlDown)))
ActiveSheet.Range("A1").AutoFilter Field:=3, Criteria1:=68
Modified.Range(Cells(2, 2), Cells(Count_Row, Count_Col)).SpecialCells(xlCellTypeVisible).Copy
lDestLastRow2 = Raw.Cells(Raw.Rows.Count, "B").End(xlUp).Offset(1).Row
Raw.Range("B" & lDestLastRow2).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Worksheets("Modified").ShowAllData
Worksheets("Modified").AutoFilterMode = False
Worksheets("Raw").Columns.AutoFit
End Sub
Attachments
Last edited: