ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting sheet (https://www.excelbanter.com/excel-programming/312869-deleting-sheet.html)

Brandi[_2_]

Deleting sheet
 
I have a macro set up in Excel that imports data from
other Excel files and then edits the data accordingly in
various sheets. There are 20 sheets in this Excel file.
If I need to edit the Excel file so that I delete a sheet
or add a sheet, what is the best way to edit the macro in
VBA? For example, is there any way to search for all of
the actions in the programming that pertain to a certain
sheet and automatically delete them? Thanks:)

SCSA25[_2_]

Deleting sheet
 

Do you already know the name of the sheet or sheets you want to delete?



As for the adding of sheets.

Sheets.Add


Then i usually name them immediately after i create them.

ActiveSheet.Name = "Name of Sheet

--
SCSA2
-----------------------------------------------------------------------
SCSA25's Profile: http://www.excelforum.com/member.php...fo&userid=1510
View this thread: http://www.excelforum.com/showthread.php?threadid=26738


Brandi[_2_]

Deleting sheet
 
Yet I already know the names of the sheets I will need to
delete, but by just deleting the sheet, it does not delete
the code that applies to that sheet, so an error appears.
Should I maybe set the macro up in a different way???
Also, the direction that you gave to add a new sheet...how
do I get the macro to import a file and do the proper text
editing, etc. like I have set up for the other sheets?
-----Original Message-----

Do you already know the name of the sheet or sheets you

want to delete?



As for the adding of sheets.

Sheets.Add


Then i usually name them immediately after i create them.

ActiveSheet.Name = "Name of Sheet"


--
SCSA25
----------------------------------------------------------

--------------
SCSA25's Profile: http://www.excelforum.com/member.php?

action=getinfo&userid=15106
View this thread:

http://www.excelforum.com/showthread...hreadid=267386

.



All times are GMT +1. The time now is 02:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com