Insert module automatically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to put a macro (see below) on the sheet that does not exist in the
original "Template File".

Basically, after I run a specific macro on the "Template File". The sheet
where I want to put the new macro is been created and named it as a "LIST".
Therefore, my question is; what statement can I use to insert this module on
this new sheet (LIST) when I run the macro on the “Template File?

Thanks in advance.
Maperalia



‘***********************************
Public LastCell As Range

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not LastCell Is Nothing Then
LastCell.Interior.ColorIndex = xlNone
End If
Target.Interior.ColorIndex = 6
Set LastCell = Target
End Sub

‘***********************************
 
Tom;
Thanks for the link. I used the macro which says "Adding A Module To A
Project". The macro works fine.
The new module is being inserted on the "Modules" list and I want it to be
inserted on the "Microsoft Excel Project" instead, under the new sheet that
has been already created (LIST) whne I run the macro.

Could you please help me.

Thanks.
Maperalia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top