Wednesday, 31 July 2019
  0 Replies
  2.9K Visits
0
Votes
Undo
All i want to do here, is copy the formulas down in row 2 (columns DB-FN) (row 1 is a header) (sheet is called "sort area")
Then i want the macro to identify the value in each row of column db and if the value of the cell in column db = "IGNORE", cut the entire row and paste the row in a different sheet (called "ignore")


'Copy Formulas down
Dim Lastrow As Long

Worksheets("sort area").Activate

Lastrow = Range("A" & Rows.Count).End(xlUp).Row
Range("DB2:FN" & Lastrow).FillDown

'Remove ignored lines

Dim n As Integer
Dim nLastRow As Long
Dim nFirstRow As Long
Dim r As Range


Set r = ActiveSheet.UsedRange
nLastRow = Lastrow - 1
nFirstRow = 2


Dim I As Long: I = 1

With ActiveSheet
For n = nLastRow To nFirstRow Step -1
If .Cells(n, "DB") = "IGNORE" Then '<----- this is the line throwing the error
.Cells(n, "DB").EntireRow.Cut Worksheets("ignore").Cells(I, "A")
.Cells(n, "DB").EntireRow.Delete
I = I + 1
End If
Next
End With
Application.ScreenUpdating = True

End Sub
There are no replies made for this post yet.