View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ade ade is offline
external usenet poster
 
Posts: 16
Default Delete cells not in Active Worksheet

I use the following code to delete cells from the Active Worksheet,

Range("A2", Cells(Rows.Count, "A")).Clear

this works fine but when I try to delete cells from a different sheet in my
Workbook I get 'Application-defined or Object-defined Error'.
The code which gives this error is,

Worksheets("NotInStock").Range("A2", Cells(Rows.Count, "A")).Clear

any suggestions as to what is wrong with the code?
Thanks.