Hi,
I have this code to kill all .xlxs file in a folder
It's possibile to substitute C:\Mytemplate with a path in a cell (eg: "A1")?Please Login or Register to view this content.
Thx in advance!
Hi,
I have this code to kill all .xlxs file in a folder
It's possibile to substitute C:\Mytemplate with a path in a cell (eg: "A1")?Please Login or Register to view this content.
Thx in advance!
Just substitute the text with a cell range.
Kill Thisworkbook.worksheets("Insert your worksheet name").Range("A1").value
I've tried this:
but it doesn't work. Where is the mistake?Please Login or Register to view this content.
.
Are you attempting to delete (Kill) a workbook whose extension is .xlsx ..... or are you attempting to clear a range of cells on a worksheet ?
If it is deleting all workbooks in a specific folder ... as designated by the path located in cell "A1" .... then :
In cell A1 your path would look something like this :Please Login or Register to view this content.
Be certain to have the last backwards slash at the end of the path " \ ". In this example, I placed a folder on the desktop with several .xlsx workbooks. The folder name was "New folder", my computer name is "My".Please Login or Register to view this content.
Or you can add a check.
Also it's not .xlxs but .xlsxPlease Login or Register to view this content.
Last edited by bakerman2; 03-18-2018 at 05:15 AM. Reason: Code tweak.
Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.
It's works! Thank you, everybody!
.
You are welcome. Bakerman : thanks for the suggestion.
Glad to help. thanks for rep.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks