Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sol Sol is offline
external usenet poster
 
Posts: 12
Default Programally add a Macro to Multiple Sheets

Hello everyone,

I've been runnning in a problem with a workbook I'm trying to make. This
workbook has a worksheet, that after filled with some datas a macro will
create "n" new worksheets on this same workbook.

These new worksheets all share some macros (doubleclick, OnChange, etc) but
not the original sheet. How can I , when I create the sheet via macro, add a
group of macros to it. Or is there a way to make a macro be accessible from
all Worksheets (but not all WORKBOOKS, mind you, only this one)?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Programally add a Macro to Multiple Sheets

hi
what you want can be done but you didn't give enought info for me to help.
see this site.
http://cpearson.com/excel/vbe.htm
macros that write macros. also move, delete, add ect.

regards
FSt1

"Sol" wrote:

Hello everyone,

I've been runnning in a problem with a workbook I'm trying to make. This
workbook has a worksheet, that after filled with some datas a macro will
create "n" new worksheets on this same workbook.

These new worksheets all share some macros (doubleclick, OnChange, etc) but
not the original sheet. How can I , when I create the sheet via macro, add a
group of macros to it. Or is there a way to make a macro be accessible from
all Worksheets (but not all WORKBOOKS, mind you, only this one)?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Programally add a Macro to Multiple Sheets

On Nov 1, 12:24 pm, FSt1 wrote:
hi
what you want can be done but you didn't give enought info for me to help.
see this site.http://cpearson.com/excel/vbe.htm
macros that write macros. also move, delete, add ect.

Why don't you just create a template sheet first with the Macros in it
and copy that?

It's not clear to me, but if you want to copy the data from the
original sheet then just copy the sheet content and paste as formulas
or values (whatever makes sense) to the template. You could delete
the template sheet at the end of the process if you wanted to.

KISS?

SteveM



regards
FSt1

"Sol" wrote:
Hello everyone,


I've been runnning in a problem with a workbook I'm trying to make. This
workbook has a worksheet, that after filled with some datas a macro will
create "n" new worksheets on this same workbook.


These new worksheets all share some macros (doubleclick, OnChange, etc) but
not the original sheet. How can I , when I create the sheet via macro, add a
group of macros to it. Or is there a way to make a macro be accessible from
all Worksheets (but not all WORKBOOKS, mind you, only this one)?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Programally add a Macro to Multiple Sheets

hi
see my reply to the post just before yours.
http://cpearson.com/excel/vbe.htm

Regards
FSt1

"FSt1" wrote:

hi
what you want can be done but you didn't give enought info for me to help.
see this site.
http://cpearson.com/excel/vbe.htm
macros that write macros. also move, delete, add ect.

regards
FSt1

"Sol" wrote:

Hello everyone,

I've been runnning in a problem with a workbook I'm trying to make. This
workbook has a worksheet, that after filled with some datas a macro will
create "n" new worksheets on this same workbook.

These new worksheets all share some macros (doubleclick, OnChange, etc) but
not the original sheet. How can I , when I create the sheet via macro, add a
group of macros to it. Or is there a way to make a macro be accessible from
all Worksheets (but not all WORKBOOKS, mind you, only this one)?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Programally add a Macro to Multiple Sheets

You can place sheet events into Thisworkbook module that will run on all sheets,
existing or new.

Using that method you don't need event code in each individual sheet.

If you don't want the code to run on the particular sheet exclude it.

Private Sub Workbook_SheetBeforeDoubleClick _
(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)

If ActiveSheet.Name = "Sheet1" Then Exit Sub

do your stuff

End Sub


Gord Dibben MS Excel MVP

On Thu, 1 Nov 2007 09:19:02 -0700, Sol wrote:

Hello everyone,

I've been runnning in a problem with a workbook I'm trying to make. This
workbook has a worksheet, that after filled with some datas a macro will
create "n" new worksheets on this same workbook.

These new worksheets all share some macros (doubleclick, OnChange, etc) but
not the original sheet. How can I , when I create the sheet via macro, add a
group of macros to it. Or is there a way to make a macro be accessible from
all Worksheets (but not all WORKBOOKS, mind you, only this one)?


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
Check Box Macro for multiple sheets Kbernbr New Users to Excel 1 August 26th 08 01:23 AM
Using a macro in multiple sheets Dan Excel Programming 1 March 28th 07 04:56 AM
Macro to protect multiple sheets? Stilla Excel Worksheet Functions 12 March 5th 07 07:03 PM
same macro on multiple sheets [email protected] Excel Programming 4 February 4th 07 10:19 PM
selecting multiple sheets in a macro Big Al[_3_] Excel Programming 6 September 10th 05 10:38 PM


All times are GMT +1. The time now is 01:51 AM.

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

About Us

"It's about Microsoft Excel"