This macro (in Revit 2014 and 2015 versions) deletes all views in the current project that are not on a sheet or are not named with the specified prefix. The macro works with all views, including dependent views. It does not delete legends and schedules.
The macro starts by getting all the views in the current model file. It then loops through the views and checks if the view is placed on a sheet. If the view is not on a sheet, the macro checks if the view name has a particular prefix. In this example, it checks for views beginning with "working". Note that you can edit the code to use any prefix you want - just change the value of the "viewPrefix" variable as shown below.
If the current view does not have the prefix and is not on a sheet, it can be deleted. The macro adds the view to a list of views to delete. Once all the views have been checked, the macro goes through the list of views to delete and removes each one from the model file.
Once all the clean-up is done, the macros displays the list of the views that have been deleted.
To get the free Delete Unused Views macro, which is part of the ArchSmarter Toolbox, one must subscribe to ArchSmarter's email updates.