This is not as small code as the method which we have seen in Example-1. There is another way to implement VBA Delete Sheet. We will see, VBA gives us the error “Subscript out of Range” which means we have selected a sheet that does not exist. Below I tried to enter the name of the sheet which is not there in the excel file as shown below. Step 7: Suppose, we try to delete a sheet that does not exist or if we end up putting an incorrect name. Step 6: We will see the sheet “Sheet1” is now deleted. We will see the system will prompt us with an Alert that excel will permanently delete the sheet. Step 5: Run the code by pressing the F5 key or by clicking on the Play Button. Step 4: Now use Delete function after the name of the selected Sheet. Step 3: Use Worksheets object and select the sheet which we want to delete.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |