I would like to delete all the empty worksheet modules for the active workbook instead of removing these one by one
it would be appreciated if someone could assist me
I would like to delete all the empty worksheet modules for the active workbook instead of removing these one by one
it would be appreciated if someone could assist me
As a worksheet module can only be deleted by deleting the worksheet itself …
This routine will remove Module1 from the current project.
This code should not be in Module1
![]()
Please Login or Register to view this content.
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.
In the previous post 'Module1' can't be obviously a worksheet module …
Thanks Marc
module1 is the main module, but by using the macro recorder one could end up with several modules that one no longer requires but one needs to delete these manually one by one
Thanks mickerickson for the code
I need to remove all blank modules for the activeworkbook, except module1
I was just giving the syntax for removing a code module.
The loop to check code modules is straight-forward.
As you write that loop, you need to test if your editor has automatically inserted Option Explicit.
thanks guys
The modules appear as
This works - but it's set to delete a module with less than three lines - take care
![]()
Please Login or Register to view this content.
If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)
You can't do one thing. XLAdept
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin
Hi xladept
Thanks , your code works perfectly
You're welcome and thanks for the rep!![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks