Delete a row

Anonymously

New Member
Joined
Mar 14, 2016
Messages
15
I have looked in multiple places for guidance on this, but nothing seems to make any sense. It seems to be a pretty simple line of code but it throws an error every time I run it.

Code:
Sheets("Process Shipment Out").Rows(2).EntireRow.delete

I've also tried:

Code:
Sheets{"Process Shipment Out").Range("A2").EntireRow.delete

The error I'm getting is "Delete method of Range class failed."

If anyone has a solution for this I would be grateful. I've been trying everything to make this work.
 

Some videos you may like

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Anonymously

New Member
Joined
Mar 14, 2016
Messages
15
No extra spaces. I've referenced the sheet in multiple other areas. I do still get that error without EntireRow.
 

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,389
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Assuming a sheet with the exact name "Process Shipment Out" (no extra spaces or ....), either of those lines should work. If the sheet exists and you have entered its tab name correctly, try retyping either line.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,959
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Also, make sure that your sheet/range is not protected!

A good way to test is to try to delete it manually. Can you?

If so, turn on your Macro Recorder and record yourself deleting the row manually, then post that code here.
 
Last edited:

Anonymously

New Member
Joined
Mar 14, 2016
Messages
15
Not that this should make a difference, but I'll post the entirety of the code here. Maybe I'm missing something. My array is working perfectly, it pastes the correct information, skips the information I don't care about, but simply won't delete this line when it's finished copying.

Code:
Sub ProcessShip()

Dim i As Integer, k As Integer, counter As Integer, v As Integer
counter = 0
v = 2
k = Sheets("Process Shipment Out").Range("A2").End(xlDown).Row - 1


For i = 0 To k


    If Sheets("Process Shipment Out").Range("N" & v) = "" Or Sheets("Process Shipment Out").Range("O" & v) = "" Or Sheets("Process Shipment Out").Range("P" & v) = "" Then
        counter = counter + 1
    Else
        Sheets("Process Shipment Out").Range("A" & v & ":P" & v).Copy
        
        With Sheets("Master List").Range("A" & Rows.Count).End(xlUp).Offset(1)
            .PasteSpecial Paste:=xlPasteValues
        End With
        
        With Sheets("Outstanding").Range("A" & Rows.Count).End(xlUp).Offset(1)
            .PasteSpecial Paste:=xlPasteValues
        End With
        
        Application.CutCopyMode = False
        Sheets("Process Shipment Out").Activate
        'On Error Resume Next
        Sheets("Process Shipment Out").Rows(v).delete


    End If
    v = v + 1
Next i


If counter = 0 Then
    Call MsgBox("There were no eligible shipments. Please fill out the shipping date, tracking number, and shipping cost for eligible shipments.", vbOKOnly, "No Shipments Found")
End If


End Sub
 

Anonymously

New Member
Joined
Mar 14, 2016
Messages
15
Well I appreciate someone making me feel pretty stupid. I forgot that I'd turned on protecting this sheet from another macro. Unprotecting the sheet worked. Thanks for the quick feedback, everyone.
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
17,256
Office Version
  1. 2013
Platform
  1. Windows
This script works for me:
You may need to check the spelling of your sheet name
Code:
Sheets("Process Shipment Out").Rows(2).EntireRow.Delete



This script was wrong because you used a "{" and it should have been a "("
Code:
Sheets{"Process Shipment Out").Range("A2").EntireRow.delete
 

Watch MrExcel Video

Forum statistics

Threads
1,123,087
Messages
5,599,658
Members
414,325
Latest member
kfg1287

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
Top