Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 8
Default Editing a macro which is within another macro.

When I am running macro1, how can I call on macro2 to edit it in order
to replace all instances of "abc" with "xyz" before continuing on and
execute macro2? Thanks for your help.

Tom
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 20
Default Editing a macro which is within another macro.

Tom

If xyz is a variable you might just change its value to something else while
calling the second macro. For example:

Sub Macro1()
Dim abc As String
abc = "Hello world!"
Call Macro2(abc)
End Sub

Sub Macro2(ByVal xyz As String)
MsgBox xyz
End Sub

--
Best regards
Robert, Excel MVP
Author of RibbonX: Customizing the Office 2007 Ribbon:
Find me at http://www.msofficegurus.com - be part of it!
FORUM: http://www.msofficegurus.com/forum/

  #3   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 8
Default Editing a macro which is within another macro.

On May 5, 6:40*pm, Robert Martim, Excel wrote:
Tom

If xyz is a variable you might just change its value to something else while
calling the secondmacro. For example:

Sub Macro1()
* Dim abc * As String
* abc = "Hello world!"
* Call Macro2(abc)
End Sub

Sub Macro2(ByVal xyz As String)
* MsgBox xyz
End Sub

--
Best regards
Robert, Excel MVP
* Author of RibbonX: Customizing the Office 2007 Ribbon:
* Find me athttp://www.msofficegurus.com- be part of it!
* FORUM:http://www.msofficegurus.com/forum/


Thanks Robert. That was great.

Regards,
Tom
  #4   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 8
Default Editing a macro which is within another macro.

On May 5, 6:40*pm, Robert Martim, Excel wrote:
Tom

If xyz is a variable you might just change its value to something else while
calling the second macro. For example:

Sub Macro1()
* Dim abc * As String
* abc = "Hello world!"
* Call Macro2(abc)
End Sub

Sub Macro2(ByVal xyz As String)
* MsgBox xyz
End Sub

--
Best regards
Robert, Excel MVP
* Author of RibbonX: Customizing the Office 2007 Ribbon:
* Find me athttp://www.msofficegurus.com- be part of it!
* FORUM:http://www.msofficegurus.com/forum/


However, there was a snag. I should have made it clearer.
Macro1 resides in File1.xls while Macro2 resides in File2.xls
and "abc" and "xyz" are both strings in Macro2. So, what do I
have to modify? Thanks.

Tom
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
Need help editing a macro ZBelden Excel Discussion (Misc queries) 3 February 12th 08 04:18 PM
Editing a macro pm Excel Discussion (Misc queries) 5 June 6th 07 11:33 PM
Editing a macro Dtmos01 Excel Discussion (Misc queries) 6 April 3rd 07 06:36 PM
Editing a Macro ChuckW Excel Discussion (Misc queries) 1 December 12th 06 07:45 PM
Editing Macro heitorfjr Excel Discussion (Misc queries) 1 January 15th 06 07:02 PM


All times are GMT +1. The time now is 06:03 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"