Trying to delete a row below specified row

Eric Penfold

Active Member
Joined
Nov 19, 2021
Messages
424
Office Version
  1. 365
Platform
  1. Windows
  2. 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
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
could be typo
VBA Code:
Cells(y + 1, "C").EntireRow.Delete
 
Upvote 0
Solution

Forum statistics

Threads
1,214,641
Messages
6,120,694
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top