Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1070
Clear the contents of an Excel Worksheet
posted

Is there an efficient/quick way to clear the contents of a worksheet? I tried iterating through all of the cells, but that takes forever?

I also tried removing the worksheet and adding a new one with the same name. This causes other problems.

  • 44743
    Verified Answer
    posted

    Currently there is no way other than to iterate the rows and cells. Make sure if you iterate rows and cells to use a foreach loop rather than a for, because a foreach will only iterate the rows and cells which have previously been accessed at some point.