Hello,
The formulas in the VBA code below work perfectly for what I'm wanting to achieve; however, I notice that it's terminating 1 row before the last line of data. I thought the "offset" might have something to do with it so when I deleted it, it wreaked havoc, haha. I think the "offset" is to not include the header but as you can see in the results, I just need Columns E, F, and H to be shifted down just one row.
The puzzling part (for me anyway), is that Column D is perfect the way it is and uses the same syntax. Why is that?
The formulas in the VBA code below work perfectly for what I'm wanting to achieve; however, I notice that it's terminating 1 row before the last line of data. I thought the "offset" might have something to do with it so when I deleted it, it wreaked havoc, haha. I think the "offset" is to not include the header but as you can see in the results, I just need Columns E, F, and H to be shifted down just one row.
The puzzling part (for me anyway), is that Column D is perfect the way it is and uses the same syntax. Why is that?
Code:
Sub A_Today()
Application.ScreenUpdating = False
With Worksheets("ShippingConfirmation").Range("C2").CurrentRegion.Columns("C")
.Offset(1, 1).Resize(.Rows.Count - 1, 1).FormulaR1C1 = "=TODAY()"
.Value = .Value
End With
With Worksheets("ShippingConfirmation").Range("D2").CurrentRegion.Columns("D")
.Offset(1, 1).Resize(.Rows.Count - 1, 1).FormulaR1C1 = _
"=IF(R[1]C7="""","""",IFERROR(LOOKUP(9.99999999999999E+307,SEARCH(""|""&INDEX(CARRIER_TBL,0,1),""|""&R[1]C7),INDEX(CARRIER_TBL,0,2)),""FedEx""))"
.Value = .Value
End With
With Worksheets("ShippingConfirmation").Range("E2").CurrentRegion.Columns("E")
.Offset(1, 1).Resize(.Rows.Count - 1, 1).FormulaR1C1 = _
"=IF(RC[-1] = ""Other"",""United Delivery Service"","""")"
.Value = .Value
End With
With Worksheets("ShippingConfirmation").Range("G2").CurrentRegion.Columns("G")
.Offset(1, 1).Resize(.Rows.Count - 1, 1).FormulaR1C1 = _
"=IF(RC[-2] = ""United Delivery Service"",""Standard"","""")"
.Value = .Value
End With
Application.ScreenUpdating = True
End Sub
Book1 | ||||||||
---|---|---|---|---|---|---|---|---|
A | D | E | F | G | H | |||
1 | order-id | ship-date | carrier-code | carrier-name | tracking-number | ship-method | ||
2 | 0000000001 | 2018-06-26 | Lasership | ?1Z9728W90301392248? | ||||
3 | 0000000002 | 2018-06-26 | Lasership | 1LS720804299375 | ||||
4 | 0000000003 | 2018-06-26 | Other | United Delivery Service | C11659806347612 | Standard | ||
5 | 0000000004 | 2018-06-26 | WM6280000000924898 | |||||
ShippingConfirmation |
Last edited: