I want to the cut and paste to be done by not selecting the cells or activating it. Eg, .select or .activate. It is possible to be done? My code below shows me error on object does not support property or method. Why is this so?
Code:
Sub test()
With Sheets("Sheet1")
A = 5
B = 4
NextRow = Application.WorksheetFunction.CountA(.Range("A:A")) + 1
Set r = .Range(.Cells(2, 1), .Cells(NextRow, 1))
For n = 2 To r.Rows.Count
If A >= B Then
If .Cells(n, 2).Value = "" Then
.Range("A" & "2" & ":K" & "n-1").Cut
End If
End If
Next n
NextRow = Application.WorksheetFunction.CountA(.Range("A:A")) + 1
Set r = .Range(.Cells(2, 1), .Cells(NextRow, 1))
For n = 2 To r.Rows.Count
If A >= B Then
If .Cells(n, 13).Value = "" Then
RowCount = .Cells(n, 2).Row
.Range("M" & RowCount).Paste
End If
End If
Next n
End With
End Sub