Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can I use a macro to create a macro in a new workbook?

I have a macro that splits data in a single worksheet into multiple workbooks based on a change of data in a particular row.

Is there a way within this macro to make it create a script in the new workbook that runs when certain cells are altered?

EggHeadCafe - Software Developer Portal of Choice
..NET Compact Framework Missing DataTable .Copy()
http://www.eggheadcafe.com/tutorials...mework-mi.aspx
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Can I use a macro to create a macro in a new workbook?

The easiest thing it to create a template with the required code, and use that template as the basis
of the workbook that you create when you split the single worksheet. Use code like

Dim myB As Workbook
Set myB = Workbooks.Add("C:\Folder\Template Name.xlt")

HTH,
Bernie
MS Excel MVP


<DANMOO wrote in message ...
I have a macro that splits data in a single worksheet into multiple workbooks based on a change of
data in a particular row.

Is there a way within this macro to make it create a script in the new workbook that runs when
certain cells are altered?

EggHeadCafe - Software Developer Portal of Choice
.NET Compact Framework Missing DataTable .Copy()
http://www.eggheadcafe.com/tutorials...mework-mi.aspx



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default Can I use a macro to create a macro in a new workbook?

The template idea is a good one.

The downside is that if you want to change the code you'll need to change
all the files that have the code embedded. This means keeping a list of all
the files that contain such code.

The alternative is to use one line of code that calls a routine in a file
that contains the macro code. Then changes only need to be made once.
The downside to this format is that everyone that needs to use the file (and
its code) need access to the file containing the macros.


"Bernie Deitrick" wrote:

The easiest thing it to create a template with the required code, and use that template as the basis
of the workbook that you create when you split the single worksheet. Use code like

Dim myB As Workbook
Set myB = Workbooks.Add("C:\Folder\Template Name.xlt")

HTH,
Bernie
MS Excel MVP


<DANMOO wrote in message ...
I have a macro that splits data in a single worksheet into multiple workbooks based on a change of
data in a particular row.

Is there a way within this macro to make it create a script in the new workbook that runs when
certain cells are altered?

EggHeadCafe - Software Developer Portal of Choice
.NET Compact Framework Missing DataTable .Copy()
http://www.eggheadcafe.com/tutorials...mework-mi.aspx



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Thanks

Cheers Bernie, simple solution, thanks.



Bernie Deitrick wrote:

The easiest thing it to create a template with the required code, and use that
19-Nov-09

The easiest thing it to create a template with the required code, and use that template as the basis
of the workbook that you create when you split the single worksheet. Use code like

Dim myB As Workbook
Set myB = Workbooks.Add("C:\Folder\Template Name.xlt")

HTH,
Bernie
MS Excel MVP

Previous Posts In This Thread:

EggHeadCafe - Software Developer Portal of Choice
Retrieve Hardware Identifiers in C# with WMI
http://www.eggheadcafe.com/tutorials...e-identif.aspx
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
macro to create a new workbook/ macro to copy columns TG Excel Programming 0 September 11th 09 06:55 PM
Macro to create new workbook WLMPilot Excel Programming 4 March 15th 08 03:48 PM
Using a macro to create a macro in another workbook Gizmo63 Excel Worksheet Functions 2 May 15th 06 09:48 AM
how to create a macro that runs other macro in the same workbook VB Script for Excel Excel Programming 4 March 23rd 06 03:53 AM
Create new workbook when macro is run [email protected] Excel Programming 2 November 14th 05 12:17 PM


All times are GMT +1. The time now is 10:13 AM.

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"