Correction of creation of CommandButton code [Closed]

-
The formally correct code would be:

ActiveWorkbook.VBProject.VBComponents(ActiveSheet.CodeName).CodeModule

... as <Sheet>.Name is only identical to <Sheet>.CodeName, if the Sheet was never renamed !
See more