Eric Penfold
Active Member
- Joined
- Nov 19, 2021
- Messages
- 424
- Office Version
- 365
- Platform
- Windows
- Mobile
Please help with this code to delete the specified row. Says "Runtime error 438"
VBA Code:
Public Sub OrderNos_PartNos_Qty()
Dim ws As Worksheet
Dim LRow As Long
Dim Row As Long
Dim i As Variant
Dim y As Variant
Set ws = ActiveSheet
LRow = Range("A2").End(xlDown).Row
Application.ScreenUpdating = False
With ws
For i = 2 To LRow
If Cells(i, "C") = Cells(i + 1, "C") Then
If Cells(i, "E") = Cells(i + 1, "E") Then
Cells(i, "G") = Cells(i, "G") + Cells(i + 1, "G")
End If
End If
Next i
For y = 2 To LRow
If Cells(y, "C") = Cells(y + 1, "C") Then
If Cells(y, "E") = Cells(y + 1, "E") Then
Cells(y + 1, "C").EntierRow.Delete
End If
End If
Next y
End With
Application.ScreenUpdating = True
End Sub