View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default 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