Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Check Box Macro for multiple sheets | New Users to Excel | |||
Using a macro in multiple sheets | Excel Programming | |||
Macro to protect multiple sheets? | Excel Worksheet Functions | |||
same macro on multiple sheets | Excel Programming | |||
selecting multiple sheets in a macro | Excel Programming |