PDA

View Full Version : "method range of object _worksheet failed" Error



sudeepsodani
10-09-2012, 05:12 AM
Hi,

I am using excel 2007 and am new to using vba code. Am trying to generate a code to delete cells in a range (around 300k rows). Here is the clearcontents option I am using. I am however, getting the error "method range of object _worksheet failed". Is this because the range is too much? Is there a better function I could use? Please advise. Thanks.

Sheet3.Range("A2:F300000").ClearContents.

patel
10-09-2012, 05:53 AM
Sheets("Sheet3").Range("A2:F300000").ClearContents

Simon Lloyd
10-09-2012, 10:09 AM
Or even betterApplication.Screenupdating = False
Sheets("Sheet3").Range("A2:F" & Sheets("Sheet3").Range("F" & Rows.Count).End(xlUp).Row).ClearContents
Application.Screenupdating = True