Deleting sheet

  • Thread starter Thread starter Brandi
  • Start date Start date
B

Brandi

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:)
 
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
 
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top