Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 150
Default Programmatically adding code to worksheet

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default Programmatically adding code to worksheet

see if this helps

http://www.cpearson.com/excel/vbe.aspx

--

Gary


"Raj" wrote in message
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Programmatically adding code to worksheet

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

On Sat, 9 Feb 2008 16:34:08 -0800 (PST), Raj wrote:

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Programmatically adding code to worksheet

Make that "to BE added to all 65 sheets"


Gord

On Sat, 09 Feb 2008 16:45:16 -0800, Gord Dibben <gorddibbATshawDOTca wrote:

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

On Sat, 9 Feb 2008 16:34:08 -0800 (PST), Raj wrote:

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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 150
Default Programmatically adding code to worksheet

On Feb 10, 5:53 am, Gord Dibben <gorddibbATshawDOTca wrote:
Make that "to BE added to all 65 sheets"

Gord

On Sat, 09 Feb 2008 16:45:16 -0800, Gord Dibben <gorddibbATshawDOTca wrote:
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


On Sat, 9 Feb 2008 16:34:08 -0800 (PST), Raj wrote:


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


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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programmatically Adding Code to a Workbook Chaplain Doug Excel Programming 1 August 24th 06 09:03 PM
Programmatically Adding Code to a Workbook Chaplain Doug Excel Programming 0 August 24th 06 04:27 PM
Adding "WorkbookOpen" Code Programmatically [email protected] Excel Programming 1 May 15th 06 08:58 AM
Adding checkboxes programmatically to a worksheet Stef Excel Programming 2 February 1st 05 03:53 PM
Programmatically adding buttons to a worksheet (Shape Object) Phil Excel Programming 3 January 26th 04 03:51 PM


All times are GMT +1. The time now is 07:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"