Be seen. Boost your questionâ€™s priority for more expert views and faster solutions
Sub August()
Dim lngLastRowD As LongPtr
Dim c As Long, lr As LongPtr
Application.ScreenUpdating = False
Sheets("Shipment Data").Activate
Application.Calculation = xlCalculationManual
With Sheets("Shipment Data")
lngLastRowD = Sheets("Shipping").Range("A800000").End(xlUp).Row
.Range("H2:H" & lngLastRowD).Formula = "=IFERROR(trim(A2)*1,A2)"
.Range("H2:H" & lngLastRowD).Copy
.Range("H2:H" & lngLastRowD).PasteSpecial xlValues
lngLastRowD = Sheets("Shipment Data").Range("A800000").End(xlUp).Row
.Range("E2:E" & lngLastRowD).Formula = "=H2"
.Range("E2:E" & lngLastRowD).Copy
.Range("E2:E" & lngLastRowD).PasteSpecial xlValues
End With
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = False
End Sub
Sub August()
Dim lngLastRowD As LongPtr
Dim c As Long, lr As LongPtr
With Application
.Calculation = xlCalculationManual
.EnableEvents = False
.ScreenUpdating = False
End With
Sheets("Shipment Data").Activate
With Sheets("Shipment Data")
lngLastRowD = Sheets("Shipping").Range("A800000").End(xlUp).Row
c = .Cells(1, Columns.Count).End(xlToLeft).Column + 1
.Range(.Cells(2, c), .Cells(lngLastRowD, c)).Formula = "=IFERROR(trim(A2)*1,A2)"
.Range(.Cells(2, c), .Cells(lngLastRowD, c)).Value = .Range(.Cells(2, c), .Cells(lngLastRowD, c)).Value
lngLastRowD = Sheets("Shipment Data").Range("A800000").End(xlUp).Row
.Range(.Cells(2, c), .Cells(lngLastRowD, c)).Copy
.Range("E2:E" & lngLastRowD).PasteSpecial xlPasteValues
End With
With Application
.Calculation = xlCalculationAutomatic
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub
Option Explicit
Sub August()
Dim lngLastRowD As LongPtr
Dim rRng As Range
Dim c As Long, lr As LongPtr
''/// you don't need to activate
'Sheets("Shipment Data").Activate
With Sheets("Shipment Data")
''/// this gets the row from a different sheet, is this correct?
Set rRng = Sheets("Shipping").Cells(1, 1).CurrentRegion
lngLastRowD = rRng.Rows.Count
''/// this works on Shipment Data?
.Range("H2:H" & lngLastRowD).Formula = "=IFERROR(trim(A2)*1,A2)"
.Range("H2:H" & lngLastRowD).Copy
.Range("H2:H" & lngLastRowD).PasteSpecial xlValues
lngLastRowD = .Cells(1, 1).CurrentRegion
''/// this works on Shipment Data?
.Range("E2:E" & lngLastRowD).Formula = "=H2"
.Range("E2:E" & lngLastRowD).Copy
.Range("E2:E" & lngLastRowD).PasteSpecial xlValues
End With
End Sub
Option Explicit
Sub August()
Dim lngLastRowD As LongPtr
Dim c As Long, lr As LongPtr
Dim rRng As Range
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
With Sheets("Shipment Data")
Set rRng = Range("A1").CurrentRegion
c = rRng.Column.Column.Count + 1
lr = rRng.Rows.Count
''///I think this is a mistake, if not explain what you use it for
'lngLastRowD = Sheets("Shipping").Range("A800000").End(xlUp).Row
.Cells(lr, c).Formula = "=IFERROR(trim(A2)*1,A2)"
.Cells(lr, c).Copy
.Cells(lr, c).PasteSpecial xlValues
'lngLastRowD = Sheets("Shipment Data").Range("A800000").End(xlUp).Row
''/// what is this for?
''/// it appears to enter the formula in the whole range
.Range("E2:E" & lngLastRowD).Formula = "=H2"
.Range("E2:E" & lngLastRowD).Copy
.Range("E2:E" & lngLastRowD).PasteSpecial xlValues
End With
.Calculation = xlCalculationAutomatic
.ScreenUpdating = False
End With
End Sub
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.