Ok here is what I want to accomplish: I am trying to copy all the VBA code from \"Sheet2\" to \"Sheet 3\" code pane. I\'m NOT referring to copying a Module from one to anoth
Thank you all! After testing multiple suggestions above, where "b" is the Worksheet name, you must use .CodeName, NOT .Name
Set CodePaste = ActiveWorkbook.VBProject.VBComponents(WorkSheets(b).CodeName).CodeModule
If you have set your target worksheet as an object:
Dim T As Worksheet
Set T = Worksheets("Test")
Then you simply need:
Set CodePaste = ActiveWorkbook.VBProject.VBComponents(Worksheets(T.Name).CodeName).CodeModule