Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running macro within a macro
When using a call function in a macro to excute a different macro and using
the shortcut key, it skips the called macro. But when the macro is selected in the tool macro menu selection and manually run it works. Is there a method to slow down the orginal macro until the called macro is completed? Thanks in advance... |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running macro within a macro
(1) If you're having the same problem as expressed in an earlier post,
please reply to that post. That way, all issues and solutions stay together for the sake of everyone reading these. (2) I tried the examples you were given earlier and had no problem. I have several macros that call other macros - sometimes stacking several deep! (that's usually poor programming - I don't recommend it!!) - and run them with no problems. (3) Do you have different macros in different modules with the same name? (4) Try posting your actual code so we can see what's happening. If it works for everyone else but not for you, the answers given may not be applicable unless we see the "inner workings". HTH Ed "norrislaketn" wrote in message ... When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. But when the macro is selected in the tool macro menu selection and manually run it works. Is there a method to slow down the orginal macro until the called macro is completed? Thanks in advance... |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running macro within a macro
Does the second macro open another workbook?
Does your shortcut key combination include the shift key? If yes, to both, then try changing the shortcut key combination to something else--don't include the shift key. norrislaketn wrote: When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. But when the macro is selected in the tool macro menu selection and manually run it works. Is there a method to slow down the orginal macro until the called macro is completed? Thanks in advance... -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running macro within a macro
first macro - used to load value in pivot table
Sub SEBU() Worksheets("Parameters").Cells(1, 1).Value = "SEBU" GOTO_Report End Sub second macro - load 2 pivot tables with value from first macro Sub GOTO_Report() 'Runs KA Report GEO a = Worksheets("Parameters").Cells(1, 1) Sheets("PvtTbl").PivotTables("PivotTable1").PivotF ields("GEO").CurrentPage = a Sheets("PvtTbl").PivotTables("PivotTable2").PivotF ields("GEO").CurrentPage = a Call HideEmptyRows Sheets("Rpt").Select Range("A1").Select End Sub third macro - called fom second macro used to hide empty rows from pivot table data ' HidesEmptyRows Macro ' ' Macro uses Sub Routine HideEmptyRows to look at all rows starting at the bottom of the ' active sheet. Moves up 1 row at a time until it reads row A. ' ' ' Function RowIsEmpty(n As Double) As Boolean If Cells(n, 1).Value = "" And Cells(n, 1).End(xlToRight).Value = "" Then _ RowIsEmpty = True Else RowIsEmpty = False End Function Sub HideEmptyRows() Dim tableEnd As Double Dim m As Double 'tableEnd is set to the last row in the spreadsheet. 'work backwards from the last row upwards and hide the row if it is empty. tableEnd = Range("a1").SpecialCells(xlCellTypeLastCell).Row For m = tableEnd To 1 Step -1 If RowIsEmpty(m) Then Cells(m, 1).EntireRow.Hidden = True Next m End Sub it seems to be bypassing the call in the second macro "Ed" wrote: (1) If you're having the same problem as expressed in an earlier post, please reply to that post. That way, all issues and solutions stay together for the sake of everyone reading these. (2) I tried the examples you were given earlier and had no problem. I have several macros that call other macros - sometimes stacking several deep! (that's usually poor programming - I don't recommend it!!) - and run them with no problems. (3) Do you have different macros in different modules with the same name? (4) Try posting your actual code so we can see what's happening. If it works for everyone else but not for you, the answers given may not be applicable unless we see the "inner workings". HTH Ed "norrislaketn" wrote in message ... When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. But when the macro is selected in the tool macro menu selection and manually run it works. Is there a method to slow down the orginal macro until the called macro is completed? Thanks in advance... |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running macro within a macro
If you add a break point, can you start the code from your shortcut key, then
restart? If not, maybe you can add some "debug.print" or "msgbox" lines in your code to find out where things are failing. norrislaketn wrote: first macro - used to load value in pivot table Sub SEBU() Worksheets("Parameters").Cells(1, 1).Value = "SEBU" GOTO_Report End Sub second macro - load 2 pivot tables with value from first macro Sub GOTO_Report() 'Runs KA Report GEO a = Worksheets("Parameters").Cells(1, 1) Sheets("PvtTbl").PivotTables("PivotTable1").PivotF ields("GEO").CurrentPage = a Sheets("PvtTbl").PivotTables("PivotTable2").PivotF ields("GEO").CurrentPage = a Call HideEmptyRows Sheets("Rpt").Select Range("A1").Select End Sub third macro - called fom second macro used to hide empty rows from pivot table data ' HidesEmptyRows Macro ' ' Macro uses Sub Routine HideEmptyRows to look at all rows starting at the bottom of the ' active sheet. Moves up 1 row at a time until it reads row A. ' ' ' Function RowIsEmpty(n As Double) As Boolean If Cells(n, 1).Value = "" And Cells(n, 1).End(xlToRight).Value = "" Then _ RowIsEmpty = True Else RowIsEmpty = False End Function Sub HideEmptyRows() Dim tableEnd As Double Dim m As Double 'tableEnd is set to the last row in the spreadsheet. 'work backwards from the last row upwards and hide the row if it is empty. tableEnd = Range("a1").SpecialCells(xlCellTypeLastCell).Row For m = tableEnd To 1 Step -1 If RowIsEmpty(m) Then Cells(m, 1).EntireRow.Hidden = True Next m End Sub it seems to be bypassing the call in the second macro "Ed" wrote: (1) If you're having the same problem as expressed in an earlier post, please reply to that post. That way, all issues and solutions stay together for the sake of everyone reading these. (2) I tried the examples you were given earlier and had no problem. I have several macros that call other macros - sometimes stacking several deep! (that's usually poor programming - I don't recommend it!!) - and run them with no problems. (3) Do you have different macros in different modules with the same name? (4) Try posting your actual code so we can see what's happening. If it works for everyone else but not for you, the answers given may not be applicable unless we see the "inner workings". HTH Ed "norrislaketn" wrote in message ... When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. But when the macro is selected in the tool macro menu selection and manually run it works. Is there a method to slow down the orginal macro until the called macro is completed? Thanks in advance... -- Dave Peterson |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running macro within a macro
All macros are in the same module and workbook. there are no duplicate macro
names. I have the macro being started by a menu button so the user does not have to use any shift or control keys "Dave Peterson" wrote: Does the second macro open another workbook? Does your shortcut key combination include the shift key? If yes, to both, then try changing the shortcut key combination to something else--don't include the shift key. norrislaketn wrote: When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. But when the macro is selected in the tool macro menu selection and manually run it works. Is there a method to slow down the orginal macro until the called macro is completed? Thanks in advance... -- Dave Peterson |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running macro within a macro
I thought the problem was when the user hit the shortcut key:
When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. Did you try putting the breakpoint in? How about the debug.print/msgboxes? norrislaketn wrote: All macros are in the same module and workbook. there are no duplicate macro names. I have the macro being started by a menu button so the user does not have to use any shift or control keys "Dave Peterson" wrote: Does the second macro open another workbook? Does your shortcut key combination include the shift key? If yes, to both, then try changing the shortcut key combination to something else--don't include the shift key. norrislaketn wrote: When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. But when the macro is selected in the tool macro menu selection and manually run it works. Is there a method to slow down the orginal macro until the called macro is completed? Thanks in advance... -- Dave Peterson -- Dave Peterson |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running macro within a macro
Just noticed that in the call statement, the Call HideEmptyRows does not
allow me to include teh "()" at the end of the statement. Is that required and wondering why it does not stay when keyed in? "Dave Peterson" wrote: I thought the problem was when the user hit the shortcut key: When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. Did you try putting the breakpoint in? How about the debug.print/msgboxes? norrislaketn wrote: All macros are in the same module and workbook. there are no duplicate macro names. I have the macro being started by a menu button so the user does not have to use any shift or control keys "Dave Peterson" wrote: Does the second macro open another workbook? Does your shortcut key combination include the shift key? If yes, to both, then try changing the shortcut key combination to something else--don't include the shift key. norrislaketn wrote: When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. But when the macro is selected in the tool macro menu selection and manually run it works. Is there a method to slow down the orginal macro until the called macro is completed? Thanks in advance... -- Dave Peterson -- Dave Peterson |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running macro within a macro
I have tried several methods.
1) Assigning it to a ctrl key such as ctrl a - skips the called macro 2) Assigning it to a menu button - skips the called macro 3) Running it from the tools, macro, macros menu tree and manually running the macro. It works in this senero only. The issue is the end users do not have the patience to use methiods 1 or 2. "Dave Peterson" wrote: I thought the problem was when the user hit the shortcut key: When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. Did you try putting the breakpoint in? How about the debug.print/msgboxes? norrislaketn wrote: All macros are in the same module and workbook. there are no duplicate macro names. I have the macro being started by a menu button so the user does not have to use any shift or control keys "Dave Peterson" wrote: Does the second macro open another workbook? Does your shortcut key combination include the shift key? If yes, to both, then try changing the shortcut key combination to something else--don't include the shift key. norrislaketn wrote: When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. But when the macro is selected in the tool macro menu selection and manually run it works. Is there a method to slow down the orginal macro until the called macro is completed? Thanks in advance... -- Dave Peterson -- Dave Peterson |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running macro within a macro
Most people use functions to pass parameters and return a value. Your function
doesn't pass any parms. norrislaketn wrote: Just noticed that in the call statement, the Call HideEmptyRows does not allow me to include teh "()" at the end of the statement. Is that required and wondering why it does not stay when keyed in? "Dave Peterson" wrote: I thought the problem was when the user hit the shortcut key: When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. Did you try putting the breakpoint in? How about the debug.print/msgboxes? norrislaketn wrote: All macros are in the same module and workbook. there are no duplicate macro names. I have the macro being started by a menu button so the user does not have to use any shift or control keys "Dave Peterson" wrote: Does the second macro open another workbook? Does your shortcut key combination include the shift key? If yes, to both, then try changing the shortcut key combination to something else--don't include the shift key. norrislaketn wrote: When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. But when the macro is selected in the tool macro menu selection and manually run it works. Is there a method to slow down the orginal macro until the called macro is completed? Thanks in advance... -- Dave Peterson -- Dave Peterson -- Dave Peterson |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running macro within a macro
What happened when you added the dubug.print/msgboxes?
norrislaketn wrote: I have tried several methods. 1) Assigning it to a ctrl key such as ctrl a - skips the called macro 2) Assigning it to a menu button - skips the called macro 3) Running it from the tools, macro, macros menu tree and manually running the macro. It works in this senero only. The issue is the end users do not have the patience to use methiods 1 or 2. "Dave Peterson" wrote: I thought the problem was when the user hit the shortcut key: When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. Did you try putting the breakpoint in? How about the debug.print/msgboxes? norrislaketn wrote: All macros are in the same module and workbook. there are no duplicate macro names. I have the macro being started by a menu button so the user does not have to use any shift or control keys "Dave Peterson" wrote: Does the second macro open another workbook? Does your shortcut key combination include the shift key? If yes, to both, then try changing the shortcut key combination to something else--don't include the shift key. norrislaketn wrote: When using a call function in a macro to excute a different macro and using the shortcut key, it skips the called macro. But when the macro is selected in the tool macro menu selection and manually run it works. Is there a method to slow down the orginal macro until the called macro is completed? Thanks in advance... -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Disable running of SelectionChange macro when in another macro? | Excel Discussion (Misc queries) | |||
disable user running macro from Tools Macro | Excel Discussion (Misc queries) | |||
Stop running a macro in the middle of a macro | Excel Programming | |||
how to get onkey macro to fire while another macro is running | Excel Programming | |||
Launch Macro in Access via Macro running in Excel??? | Excel Programming |