Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default "delete method of range class failed



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


*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default "delete method of range class failed

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


"Kathy Goldie" wrote:



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


*** Sent via Developersdex http://www.developersdex.com ***

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default "delete method of range class failed



WOW - THAT WAS TOO SIMPLE
THANKS FOR THE HELP :-)

*** Sent via Developersdex http://www.developersdex.com ***
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete method of Range class failed - HELP!!! richilli Excel Programming 1 October 20th 04 06:24 PM
VBA error 1004 "Select method of Range class failed" Matt J Excel Programming 6 July 3rd 04 10:05 PM
Error 1004, "select method of range class failed" paritoshmehta[_11_] Excel Programming 3 May 6th 04 10:09 PM
runtime error '1004' delete Method of Range Class Failed Tom Kennedy Excel Programming 0 April 14th 04 08:08 PM
runtime error '1004' delete Method of Range Class Failed Tom Ogilvy Excel Programming 0 April 1st 04 04:09 AM


All times are GMT +1. The time now is 02:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"