I get the run-time error. I added a couple IF’s to the original formula. I believe the error is caused by multiple duplicate results (see the code below) like RTP and PNYP. If this is the case, how can I get the desired results? This is for code farther down the line to do CountIfs and SumIfs the result appears in a worksheet column.
<code>With Sheet12 'Sheet12 = Raw Data - DS
.Columns("C:D").Insert shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
.Range("G2:G" & .Cells(.Rows.count, "F").End(xlUp).Row).FormulaR1C1 = _
"=IF(RC[-1]=""Crossdock"",""CD"",IF(RC[-1]=""ReadyToPick"",""RTP"",IF(RC[-1]=""ReadyToPickUnconstrained"",""RTP"",IF(RC[-1]=""PickingPicked"",""PP"",IF(RC[-1]=""PickingPickedAtDestination"",""PP"",IF(RC[-1]=""PickingNotYetPickedPrioritized"",""PNYP"",IF(RC[-1]=""PickingNotYetPickedNotPrioritized"",""PNYP"",IF(RC[-1]=""Loaded"",""LD"","""")))))"
End With
</code>
<code>With Sheet12 'Sheet12 = Raw Data - DS
.Columns("C:D").Insert shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
.Range("G2:G" & .Cells(.Rows.count, "F").End(xlUp).Row).FormulaR1C1 = _
"=IF(RC[-1]=""Crossdock"",""CD"",IF(RC[-1]=""ReadyToPick"",""RTP"",IF(RC[-1]=""ReadyToPickUnconstrained"",""RTP"",IF(RC[-1]=""PickingPicked"",""PP"",IF(RC[-1]=""PickingPickedAtDestination"",""PP"",IF(RC[-1]=""PickingNotYetPickedPrioritized"",""PNYP"",IF(RC[-1]=""PickingNotYetPickedNotPrioritized"",""PNYP"",IF(RC[-1]=""Loaded"",""LD"","""")))))"
End With
</code>
With Sheet12 'Sheet12 = Raw Data - DS
.Columns("C:D").Insert shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
.Range("G2:G" & .Cells(.Rows.count, "F").End(xlUp).Row).FormulaR1C1 = _
"=IF(RC[-1]=""Crossdock"",""CD"",IF(RC[-1]=""ReadyToPick"",""RTP"",IF(RC[-1]=""ReadyToPickUnconstrained"",""RTP"",IF(RC[-1]=""PickingPicked"",""PP"",IF(RC[-1]=""PickingPickedAtDestination"",""PP"",IF(RC[-1]=""PickingNotYetPickedPrioritized"",""PNYP"",IF(RC[-1]=""PickingNotYetPickedNotPrioritized"",""PNYP"",IF(RC[-1]=""Loaded"",""LD"","""")))))"
End With