Clear the contents of all cells in an Excel File???
I have a button on my program. When clicked, I want it to open a pre-determined file and clear the content of every cell in that file. I know how to access excel files and pick a designated one and all that.
Anyone know any code for clearing the contents of all cells?
Thanks.
Re: Clear the contents of all cells in an Excel File???
Excel.Range.ClearContents();
Re: Clear the contents of all cells in an Excel File???
What do I put for the range?
I'm used to putting (1, 1) to reference cell A1. How do I specify a range that clears everything on the spreadsheet?
Thanks.
Re: Clear the contents of all cells in an Excel File???
Greetings fellow irishman :)
For a range, enter 'A1:IV65536' you can't have anything outside that. Although there is probably some handy function to get a range of everything.
Re: Clear the contents of all cells in an Excel File???
oops! Here is the correct version!!!
xl.displayalerts=false
xls.cells.select
xls.delete