Hello. I'm using this code, but can only seem to get it to work if I add a redundant column at the end of my dataset. In order to to that, I'm referencing column M, but in reality, I'd like to just be able to reference column H. I'm almost positive that it has to do with the offset and resize parameters?
VBA Code:
Option Explicit
Sub ExportLogisticsRecords()
Dim StatusCol As Range
Dim Status As Range
Dim PasteCell As Range
Set StatusCol = Sheet1.Range("M2:M10002")
For Each Status In StatusCol
If Sheet5.Range("A2") = "" Then
Set PasteCell = Sheet5.Range("A2")
Else
Set PasteCell = Sheet5.Range("A1").End(xlDown).Offset(1, 0)
End If
If Status Like "*-L" Then Status.Offset(0, -12).Resize(1, 12).Copy PasteCell
Next Status
End Sub