Macro to delete a Macro RRS feed

  • Question

  • I'm doing a macro for time studies. This macro creates a button and attaches a macro that captures times. This macro stores the code in Sheet4 not in a Module. I need a macro to delete all the code in Sheet4. Can anyone please help me?
    Friday, July 1, 2016 3:03 PM

All replies

  • Put this code in a regular module:
        With ThisWorkbook.VBProject.VBComponents(Sheet4.CodeName).CodeModule
            .DeleteLines 1, .CountOfLines
        End With

    Make sure you have this option on: -

    Friday, July 1, 2016 5:39 PM