Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Deleting Rows 2

Status
Not open for further replies.

mattygriff

Programmer
May 14, 2001
350
GB
Probably a simple solution to this one but I can't for the life of me work out what the problem is. Here's my code.....

Code:
Sheet18.Unprotect

Sheet18.Range("A8:E9").Select
Selection.EntireRow.Delete

Sheet18.Protect

When I try and run this code I get a "Run-time error '1004': Select method of Range class failed" dialog.

So whose first up to make me look stupid?
 
What about something like this ?
Sheets("Sheet18").Range("A8:E9").EntireRow.Delete

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV - thanks but that gives me a "Subscript out of range" error instead!
 
So, use an existing sheet's name.
BTW, have you several workbooks open ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 




Your Sheet Object is MISS IDENTIFIED!

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks, both.

PHV - Sheet18 is an existing sheet and I only have one workbook open.

Skip - Mis-identified how?
 



How?

Post you code please.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Skip,

My code is in the OP (for some reason my
Code:
delimiters didn't work!)

This seems like such a simple thing to do and I can't understand what the problem is - I've tried recording a macro to do what I need and it comes up with the same code as I've used.
 




The OP has problems!!!!

That's why!
Code:
Sheet18.Range("A8:E9").EntireRow.Delete


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top