ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Question about merging macros (https://www.excelbanter.com/excel-worksheet-functions/39185-question-about-merging-macros.html)

Greegan

Question about merging macros
 
I have a custom menu with specific macros I've recorded (or ones you folks
have been helpful in providing).
Say one formats Zip Codes for a 5-digit format, and another fills a blank
column with a default country code of "US", and there are others as well...

Now what I've been doing, as my work requires, is to copy and paste perhaps
both or more macro commands into new macros.

The end result is that when I'm trying to fix an error, change a value, or
create a new one using all or part of the two macros (for this example) into
a new command (say I want to change the new macro to include "CA" for
Canada's country code) I have to scroll through a lot of text before I find
what I'm looking for...

My question is... is there a way to reference another macro command without
having to copy the complete text into (the new) another macro?

Thanks in advance...
G



Vasant Nanavati

Not sure exactly what you mean, but you can call a macro from another macro
as follows:

Sub Macro1()
Call Macro2
End Sub

The Call keyword is optional and can be omitted; I like to use it for
clarity.

--

Vasant


"Greegan" wrote in message
...
I have a custom menu with specific macros I've recorded (or ones you folks
have been helpful in providing).
Say one formats Zip Codes for a 5-digit format, and another fills a blank
column with a default country code of "US", and there are others as
well...

Now what I've been doing, as my work requires, is to copy and paste
perhaps both or more macro commands into new macros.

The end result is that when I'm trying to fix an error, change a value, or
create a new one using all or part of the two macros (for this example)
into a new command (say I want to change the new macro to include "CA" for
Canada's country code) I have to scroll through a lot of text before I
find what I'm looking for...

My question is... is there a way to reference another macro command
without having to copy the complete text into (the new) another macro?

Thanks in advance...
G




Bob Phillips

In the module code pane, click on the dropdown at the top right of the pane,
and you will see a list of the macros in that module.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Greegan" wrote in message
...
I have a custom menu with specific macros I've recorded (or ones you folks
have been helpful in providing).
Say one formats Zip Codes for a 5-digit format, and another fills a blank
column with a default country code of "US", and there are others as

well...

Now what I've been doing, as my work requires, is to copy and paste

perhaps
both or more macro commands into new macros.

The end result is that when I'm trying to fix an error, change a value, or
create a new one using all or part of the two macros (for this example)

into
a new command (say I want to change the new macro to include "CA" for
Canada's country code) I have to scroll through a lot of text before I

find
what I'm looking for...

My question is... is there a way to reference another macro command

without
having to copy the complete text into (the new) another macro?

Thanks in advance...
G






All times are GMT +1. The time now is 08:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com