Kill Command in Excel (Delete Files Using VBA)

Add to Favorites
Author: | Edits: don

How to safely remove, delete, kill any Excel file, or other file, using VBA Macros in Excel.

You will learn how to build a macro that can delete files based on different conditions:

  • How to delete all macro-enabled files.
  • How to delete all Excel files.
  • How to delete only xlsx files.
  • How to delete files from a certain date or date range.
  • How to delete files with certain patterns or text or numbers in their name.
  • How to check if a file exists before trying to delete it.

This tutorial is a small version of the Kill Command tutorial in my full VBA course.

Resources:

Kill Command for VBA (microsoft link)


Downloadable Files: Excel File

Question? Ask it in our Excel Forum


Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons 50+ Hours of Instruction 200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Similar Content on TeachExcel
Naming Cells in Excel to Make Using Formulas/Functions Easier
Tutorial: In this tutorial I am going to introduce the idea of Named Cells. A Named Cell is a cell w...
Hide Comments in Excel Completely - Even Indicators Will not Appear
Macro: Hide all comments in an Excel workbook. No indicators will be displayed and comments will ...
Regular Expression Search Formula in Excel - Regex
Tutorial: Part 1 - Regular Expression Match Formula in Excel (No VBA) Part 2 - Complete Excel Reg...
Goal Seek in Excel
Tutorial: Find a desired result by having Excel automatically change input values in Excel. Using ...
Quickly Copy the Last Action to Multiple Cells in Excel
Tutorial: In the previous tutorial I talked about the Redo button in Excel and how using Ctrl + Y ca...
Shade Every Other Row in Excel Quickly
Tutorial: How to shade every other row in Excel quickly without using the Table feature. This method...
Tutorial Details
Downloadable Files: Excel File
Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course