Macro inside another macro?

I like to refer to another macro within another macro.

Is this possible?
Does this work?

sub macro1()
....
....

    sub Macro2()
     ....
    ....
    end sub

.....
.....
end sub
?

0
anonymous (74722)
2/2/2005 12:16:53 AM
excel.misc 78881 articles. 5 followers. Follow

3 Replies
361 Views

Similar Articles

[PageSpeed] 0

Yes this does work. 



>-----Original Message-----
>I like to refer to another macro within another macro.
>
>Is this possible?
>Does this work?
>
>sub macro1()
>....
>....
>
>    sub Macro2()
>     ....
>    ....
>    end sub
>
>.....
>.....
>end sub
>?
>
>.
>
0
anonymous (74722)
2/2/2005 12:35:35 AM
thank you


>-----Original Message-----
>Yes this does work. 
>
>
>
>>-----Original Message-----
>>I like to refer to another macro within another macro.
>>
>>Is this possible?
>>Does this work?
>>
>>sub macro1()
>>....
>>....
>>
>>    sub Macro2()
>>     ....
>>    ....
>>    end sub
>>
>>.....
>>.....
>>end sub
>>?
>>
>>.
>>
>.
>
0
anonymous (74722)
2/2/2005 12:42:52 AM
Not like that. You can have macro code within a macro or call another macro
sub macro1
call macro2
end sub

or
sub macro1
macro2 code here
end sub


-- 
Don Guillett
SalesAid Software
donaldb@281.com
"thrava" <anonymous@discussions.microsoft.com> wrote in message
news:02df01c508bc$7f9e6cd0$a401280a@phx.gbl...
> I like to refer to another macro within another macro.
>
> Is this possible?
> Does this work?
>
> sub macro1()
> ...
> ...
>
>     sub Macro2()
>      ....
>     ....
>     end sub
>
> ....
> ....
> end sub
> ?
>


0
Don
2/2/2005 1:25:41 AM
Reply:

Similar Artilces:

File modified by another user
I have recently upgraded my PC to Windows XP SP2 and am having a curious problem. When I attempt to save the file, I get a dialog box stating the file might have been modified by another user - do I wish to save a copy or overwrite changes. The workbook is not shared - however, it does reside on a Linux Samba share. But then again, it has always resided on the share. Only since the SP2 update, has this started happening: These are the steps I followed: 1. Opened Excel 2. Opened the file on the Samba share 3. Clicked SAVE 4. Got the dialog box asking to overwrite changes or s...

Repeating instructions in a Macro.
Hello all, I have a Macro that clears any data on different 31 tabs and, due to my lack of knowledge, I do this one tab at a time. The 31 tabs represent the maximum possible days in a month. Here's a sample of my Macro: '====================================================================================================================== ' Clear the data on tab 1. Windows("Revenue Tracker.xls").Activate Sheets("1").Select Range("B4:O126").Select Selection.ClearContents Range("E4").Select '-----------------...

What wrong is macro with signcert?
I have been setup signcert within office 2003, and assign its cert into macro, so I can skip the security pop up message whenever I open this file and it works properly. Recently, I need to assign password for my XP user account in order to enable hibernation mode, then when I open the worksheet, it pops message for macro security again, but this time, the select option is disable for always trust this cert, so I need to manually select enable macro. Does anyone have any suggestions on how to solve this signcert issue? Thanks in advance for any suggestions Eric When I re-create ...

macro results wrong
I recorded marcos in a workbook. I then saved the workbook uder a ne name . Naturauly I had to modify the macro ref file names to the new fil name. I can now run the macros , however I get the wrong results. example: i have this formular =if(data!c5=0,0,data!c5/data!d5) in the orignal workbook it works fine when I copy an autofill the fields in that column. In the new workbook the formular is right but th resutant value is a constant for all the auto filled cells!! eg. if th cell A1 = 3 all the other cells A2 , A3 , A4 are dispalying 3 enven the formula shows otherwise. Please help :co...

HELP!! Charts won't copy across to another worksheet
Help Please. I have a sheet which has all my descriptive stats on it and graphs drawn from this data. There are 100 charts on the sheet. I am trying to copy the whole sheet WITH the CHARTS. Then I shall only have to change some of the formulas to perform other comparisons. My problem is whichever means I sue to copy the sheet the data cells copy. The gaps are there where the charts should be. NO CHARTS. Any advice grateful received. Have you tried making a second copy of the sheet by holding down CTRL and dragging the sheet tab to the right? best wishes -- Bernard V Liengme www.stfx...

how do I insert a filename into a formula from another cell?
I have a spreadsheet with a filename in a cell. I would like to reference that filename in a formula. I can't seem to get it to work. "+cell number" doesn't work. Any suggestions? You would normally use INDIRECT to do this, along the lines of: =INDIRECT("["&A1&"]Sheet1!C2") where A1 contains your filename (with the .xls extension) and you are trying to return data from C2 on Sheet1 of that file. However, INDIRECT will only work with files that are open, so you would have to have the file open for this to work. Hope this helps. Pete On...

UNABLE TO RECORD EXCEL MACRO
Hello, I was able to record excel macros up until last week. There was a pop-up informing me of a MISSING Visual Basic Library. Thereafter, when I try to record excel macro, I receive a pop-up message "Unable to Record". I have tried DETECT and REPAIR and even uninstalled and reinstalled my MS Office XP. However the problem still persisted. Please advise. THX. You will need to go into the Visual Basic Editor, selec "Tools"/"References" from the toolbar and check the appropriat libraries are selected. You should have as a minimum: Visual Basic For Appl...

copy a pivot table to another sheet in a macro
Hi there, I created a macro that will copy copy the information from a created pivot table to another sheet. I seemed ok when I recorded the macro. But there's no pivot table on the new sheet when I run the macro. What should I do to correct the problem? Thanks, Aline -- Aline Record another macro when you try it again? If it fails again, you may want to describe what you did to copy the data (copy the cells to a new sheet or copy the sheet???). And share the code (that fails) that does the copy. Aline wrote: > > Hi there, > > I created a...

Macro code behind button
How do I find out what macro and the code assigned to a specific button in an Excel worksheet? I can view all the macros assigned to the workbook, but it appears that there may be other macros running on these buttons (my personal list of macros is empty)(I am the author of the workbook). Right-click on button, assign macro. See that is assigned. If an ActiveX control, you may need to click on "view code". Alternatively, you can bring up the VBE (Alt+F11) and look through the different parts of your workbook to see what coding is in there. -- Best Regards, Lu...

how 2 create and run a macro
i want to try record a new macro. can you teach me the way to create and run it. i am facing the problem Hi a good introduction to macros can be found at: http://www.mvps.org/dmcritchie/excel/getstarted.htm -- Regards Frank Kabel Frankfurt, Germany Lee Sok Har wrote: > i want to try record a new macro. can you teach me the way to create > and run it. > i am facing the problem ...

How can I look in a sharing folder of another computer?
I have a home network of 4 computers - 2 WinXP, Vista, Win7. The network works normally. I can easily look in a sharing folder of another computer by my Total Commander. But I made a bootable BartPE CD. After booting from the CD I can get online and browse any sites around the world, but I cannot look in a nearby computer folder! Every time I get the following message. "Workgroup is not accessible. You might not have permission to use... " How do I fix this problem? Thank you Lev "Levlg" <levlg@tpg.com.au> wrote in message news:4ba0b9b4$1@d...

Mailbox permssions from one storage group to another
I have two storage groups, each with one mailbox store. The first storage group contains a public folder store. All of the permissions for the users in the first storage appear to be correct and functioning normally. Everyone in the second storage group looks to have much different inherited mailbox permissions that don't look to be correct. Almost all of the groups including administrator, enterprise admin, exchange domain server have inherited allow AND deny for full mailbox access. Is this correct? I doesn't seem right to me... Where do you change what inherited rights are aqu...

locking tabs w/macros
i have a workbook that employees use to track project progress. they enter project data into sheet 1 and vbscript macros manipulate this data and output it in various ways on worksheets 2-15. i want to lock sheets 2-15 so employees cannot enter data, but when i protect those sheets the macros are no longer permitted to work. is there a way i can prevent cell editing by USERS but permit editing by MACROS? this seems like it should be fairly obvious, but i cant figure it out. thanks in advance! Hi eric, 1) you might want to use the following instruction when protecting the sheets: ...

Attachment inside word
Hello, How can I attach my excel spreadsheet inside MS word. So that when th user opens MS Word and icon appears containing my excel file. Is thi possible? please help, ThaNKS -- kkondrat ----------------------------------------------------------------------- kkondrat1's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=600 View this thread: http://www.excelforum.com/showthread.php?threadid=27213 Hi in Word use 'Inser - Object - From file'. Choose your Excel file and check 'Display as Icon' -- Regards Frank Kabel Frankfurt, Germany kkondrat1...

Macros #12
I didn't see a group for Excel Macros so I'm posting here. I created a macro, saved it in the workbook that I was working on, gave it a short cut key stroke and it all worked perfectly. When done with the exercise I deleted the macro from that workbook. When I open a new workbook the ctrl key still activates the macro. I can't find where or how I delete the short cut key combo for that macro? All help is appreciated. Thanks in advance. SteveR "Steve" <SteveR7138@msn.com> wrote in news:ebQ92OWsFHA.3604@tk2msftngp13.phx.gbl: > I didn't see a gro...

Another Issue With A Function
Ron Rothstein suggested and I used this function in my Excel 2003 Workbook: Public Function QBRushYds(W, Q) QBRushYds = Worksheets("Week" & W).Range("C2").Offset(Q).Value / 10 End Function In Worksheet Totals Cell B56 thru B59 I have the following four calculations: =TRUNC(QBRushYds(1,1)) =TRUNC(QBRushYds(1,2)) =TRUNC(QBRushYds(1,3)) =TRUNC(QBRushYds(1,4)) In Worksheet Week1 Cells C3 thru C6 I have the following values: 725 814 283 9 The function correctly calculates the values: 72 81 28 0 If I change any of the values in C3 th...

Another MFC extension DLL problem
I have an entry point defined like this: #ifndef BUILDING_UTILITY #define _UL_EXT_CLASS _declspec(dllimport) #else #define _UL_EXT_CLASS _declspec(dllexport) #endif void _UL_EXT_CLASS AttachToUtilityLib(LPCTSTR pszString) When I try to link the dll to another extension DLL, MyMessageBox is unresolved. If I take out the LPCTSTR parameter, it links fine. What could be wrong here? Maybe it's a name mangling issue, are this DLL's both C++ ? I assume you use different defines for your two DLL's otherwise you may have conlicts here. Cyrille Dupuydauby "David W. Simmo...

transfer shares from one a/c to another, lose history
Hi, To transfer shares from one investment account to another, which is the best option to use? I have been using the transfer out option, but by doing that, all the transaction history is lost. Is there a way to preserve it? Thanks. It's still preserved in the original account. "ab" <nospam@nospam.hotmail.com> wrote in message news:26qqf.4339$Ou3.1708@dukeread09... > To transfer shares from one investment account to another, which is the > best option to use? I have been using the transfer out option, but by > doing that, all the transaction history is l...

Goto Macro #2
Hi I run Win2K with Excel 2K I require a macro that when I place a number in a cell that the curser then jumps to a particular cell (or range name if that is the better way to do it) ie; Action In cell A1 I type the number 1 Result The curser jumps to cell A20 Action In cell A1 I type the number 2 Result The curser jumps to cell A21 etc etc etc Any help is much appreciated John Calder John In the sheet module.................... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count > 1 Then Exit Sub If Intersect(Target, Me.Range("A1")) Is No...

Macro help please
First I'll say hello. I'm short of time right now, but will be back soon. I do have a problem to solve. I'm trying to write a macro that monitors a cell (W30) and then runs a sub when the value of the cell changes to "1". The sheet will run 24/7, and so should the macro. The value of the sheet will change via DDE link. I've tried macros that detect a cell change in value, but they insist on the (enter) key. Thanks for any help in advance. Gotta run, be back soon. :cool: ------------------------------------------------ ~~ Message posted from http://www.Ex...

Send To Macro
Hi guys, I can set a macro to send the workbook to an emai address/group. What I'm looking for is a way to send just a hyperlin to the file itself instead of the file. FILESIZE being the issue here. Any ideas would be greatly appreciate -- theshelton ----------------------------------------------------------------------- thesheltons's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1544 View this thread: http://www.excelforum.com/showthread.php?threadid=27042 This may help: http://groups.google.com/groups?threadm=3EC1827F.CA57713B%40msn.com But read the w...

How to open another user's folder list?
Hello, I have Outlook 2002 SP3 and Windows XP SP2. In my Folder List I have my mailbox expanded showing all my folders (inbox, calendar, contacts, etc.). I also have the mailbox for our general company email account (info@) that receives the emails submitted from our website. But when I click on the + sign next to it to expand it, I get a message saying "Unable to expand the folder. The set of folders could not be opened. The operation failed." This company email is set up as it's own user on our network, and I am set as it's delegate with full control over all it's ...

Copying emails from one os to another
I recently upgraded the os on my computer and I was wondering how to copy messages from one os to the other. Jamie White <jamie.boss@jatos.co.uk> wrote: > I recently upgraded the os on my computer and I was > wondering how to copy messages from one os to the other. http://www.slipstick.com/config/backup.htm -- Brian Tillman ...

Macros--excel 2000...
The stop dialog box, should but does not appear when I begin to write a macro. Thus I am unable to write a macro using relative cell reference. What do I have to do to get the sstop dialog box to show up when I initiate a amcro? To reactivate the Stop Recording toolbar: Choose Tools>Macro>Record New Macro Click OK Choose View>Toolbars>Stop Recording Click the Stop Recording button (the blue square) The next time you record a macro, the toolbar should automatically appear. When you're finished recording, click the Stop Recording button If you close the toolbar by click...

create a spreadsheet from another app
Hi, I am creating Excel spreadsheets from our application. We start Excel and then send DDE commands to it to create spreadsheets. Is there a better way of doing this that is not so error prone ? Excel seems to have DDE problems often and there seems to be some mysterious re-entrency problems where both our application and Excel will have be restarted in order to get the communication flowing again. Sincerely, Lynn McGuire On Jun 26, 1:43=A0am, Lynn McGuire <l...@winsim.com> wrote: > Hi, > > I am creating Excel spreadsheets from our application. =A0We start > Excel and t...