"delete method of range class failed

K

Kathy Goldie

I get this error message
"delete method of range class failed"
when trying to do do a simple macro
I have moved the END IF's to diff places - seems if there is nothing in
E22 it does the delete shift up - then the next occurrance that is true
generates the error

Sheets("Sheet1").Visible = True
Sheets("Sheet1").Select
Range("E22").Select
If ActiveCell = "" Then
Range("A22:E22").Select
Selection.Delete Shift:=xlUp
Range("J22").Select
If ActiveCell = "" Then
Range("F22:K22").Select
Selection.Delete Shift:=x1Up
Range("K22").Select
If ActiveCell = "" Then
Range("F22:K22").Select
Selection.Delete Shift:=x1Up
Range("P22").Select
If currentCell = "" Then
Range("L22:p22").Select
Selection.Delete Shift:=x1Up
End If
End If
End If
End If
 
G

Guest

Give this a try

With Sheets("Sheet1")
.Visible = True
If .Range("E22").Value = "" Then _
.Range("A22:E22").Delete Shift:=xlUp
If .Range("J22").Value = "" Then _
.Range("F22:K22").Delete Shift:=xlUp
If .Range("K22").Value = "" Then _
.Range("F22:K22").Delete Shift:=xlUp
If .Range("P22").Value = "" Then _
.Range("L22:p22").Delete Shift:=xlUp

End With

HTH

Jim Thomlinson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top