Programmatically adding code to worksheet

  • Thread starter Thread starter Raj
  • Start date Start date
R

Raj

Hi,

When I need to add code to a worksheet, I rightclick on the sheet tab
bearing the sheetname, choose "View Code" and, paste the code.

Is there a way to do this programmatically as I have to insert the
worksheet code in 65 sheets.

Thanks in advance for the help.

Raj
 
Is it the same code to added to all 65 sheets?

Add it once in Thisworkbook module to cover all sheets.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
your code
End Sub


Gord Dibben MS Excel MVP
 
Make that "to BE added to all 65 sheets"


Gord

Is it the same code to added to all 65 sheets?

Add it once in Thisworkbook module to cover all sheets.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
your code
End Sub


Gord Dibben MS Excel MVP
 
Make that "to BE added to all 65 sheets"

Gord

Thanks, Gary and Gord. I will study the excellent resource given by
Gary. I am sure that I will find my solution there.

Gord, I omitted to say something in my first post. The 65 sheets are
in 65 DIFFERENT workbooks but have the same name ("Data") in all
workbooks. Any quick code for that?

Thanks, once again.
Raj
 

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