Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Running Excel 2007 under WinXPPro
I wrote four macros. The first three each do a specific funtion and are named NameStateSum1, 2 and 3. The fourth one is named NameStateSum (no suffix) and it simply runs the three numbered macros in order. The parent macro is set up to run on CNTL+SHFT+N If I run the parent macro from the developer tab, it runs fine. When I try to run it with the shortcut keys, it executes only the first of three submacros and stops. Any idea what's causing this and how I can make it work with the shortcut keys? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
it would help if you show the macro code....
"Ted M H" wrote: Running Excel 2007 under WinXPPro I wrote four macros. The first three each do a specific funtion and are named NameStateSum1, 2 and 3. The fourth one is named NameStateSum (no suffix) and it simply runs the three numbered macros in order. The parent macro is set up to run on CNTL+SHFT+N If I run the parent macro from the developer tab, it runs fine. When I try to run it with the shortcut keys, it executes only the first of three submacros and stops. Any idea what's causing this and how I can make it work with the shortcut keys? |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Here's the macro code:
Sub NameStateSum() ' ' NameStateSum Macro ' This macro runs the three submacros to create and format a pivot table form the Names and Addresses workbook. ' ' Keyboard Shortcut: Ctrl+Shift+N ' Application.Run "PERSONAL.XLSB!NameStateSum1" Application.Run "PERSONAL.XLSB!NameStateSum2" Application.Run "PERSONAL.XLSB!NameStateSum3" ActiveWorkbook.RunAutoMacros Which:=xlAutoClose End Sub Sub NameStateSum1() ' ' NameStateSum1 Macro ' This macro will open the Names and Addresses workbook with the xource data for PivotTable. ' ' ChDir _ "C:\Documents and Settings\Ted Horsch\Desktop\MentorTraining Exercise Files" Workbooks.Open Filename:= _ "C:\Documents and Settings\Ted Horsch\Desktop\MentorTraining Exercise Files\Names and Addresses.xlsx" Workbooks.Add ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\Ted Horsch\Desktop\MentorTraining Exercise Files\Summary by State.xlsx" _ , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False End Sub Sub NameStateSum2() ' ' NameStateSum2 Macro ' This macro creates a PivotTable of employee last names by state and counts the employees in each state. ' ' ActiveWorkbook.PivotCaches.Create(SourceType:=xlDa tabase, SourceData:= _ "C:\Documents and Settings\Ted Horsch\Desktop\MentorTraining Exercise Files\Names and Addresses.xlsx!ClientList" _ , Version:=xlPivotTableVersion12).CreatePivotTable TableDestination:= _ "Sheet1!R1C1", TableName:="PivotTable3", DefaultVersion:= _ xlPivotTableVersion12 Sheets("Sheet1").Select Cells(1, 1).Select With ActiveSheet.PivotTables("PivotTable3").PivotFields ("LastName") .Orientation = xlRowField .Position = 1 End With With ActiveSheet.PivotTables("PivotTable3").PivotFields ("State") .Orientation = xlColumnField .Position = 1 End With ActiveSheet.PivotTables("PivotTable3").AddDataFiel d ActiveSheet.PivotTables( _ "PivotTable3").PivotFields("FirstName"), "Count of FirstName", xlCount ActiveSheet.PivotTables("PivotTable3").TableStyle2 = "PivotStyleLight22" ActiveSheet.PivotTables("PivotTable3").ShowTableSt yleRowStripes = True ActiveSheet.PivotTables("PivotTable3").RowGrand = False End Sub Sub NameStateSum3() ' ' NameStateSum3 Macro ' This macro renames the worksheet and saves the file. ' ' Sheets("Sheet1").Select Sheets("Sheet1").Name = "Summary by State" ActiveWorkbook.Save End Sub "Ted M H" wrote: Running Excel 2007 under WinXPPro I wrote four macros. The first three each do a specific funtion and are named NameStateSum1, 2 and 3. The fourth one is named NameStateSum (no suffix) and it simply runs the three numbered macros in order. The parent macro is set up to run on CNTL+SHFT+N If I run the parent macro from the developer tab, it runs fine. When I try to run it with the shortcut keys, it executes only the first of three submacros and stops. Any idea what's causing this and how I can make it work with the shortcut keys? |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If you open a workbook with the shift key held down, then excel thinks you don't
want to run the auto_open or workbook_open procedures. And since your shortcut key includes the shift key, it's confusing excel and excel thinks you want to stop. Remove the shift key from your shortcut key and try it out. Ted M H wrote: Running Excel 2007 under WinXPPro I wrote four macros. The first three each do a specific funtion and are named NameStateSum1, 2 and 3. The fourth one is named NameStateSum (no suffix) and it simply runs the three numbered macros in order. The parent macro is set up to run on CNTL+SHFT+N If I run the parent macro from the developer tab, it runs fine. When I try to run it with the shortcut keys, it executes only the first of three submacros and stops. Any idea what's causing this and how I can make it work with the shortcut keys? -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I LOVE this discussion group! Dave, thanks a million for solving my problem
for me. "Dave Peterson" wrote: If you open a workbook with the shift key held down, then excel thinks you don't want to run the auto_open or workbook_open procedures. And since your shortcut key includes the shift key, it's confusing excel and excel thinks you want to stop. Remove the shift key from your shortcut key and try it out. Ted M H wrote: Running Excel 2007 under WinXPPro I wrote four macros. The first three each do a specific funtion and are named NameStateSum1, 2 and 3. The fourth one is named NameStateSum (no suffix) and it simply runs the three numbered macros in order. The parent macro is set up to run on CNTL+SHFT+N If I run the parent macro from the developer tab, it runs fine. When I try to run it with the shortcut keys, it executes only the first of three submacros and stops. Any idea what's causing this and how I can make it work with the shortcut keys? -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I've discovered a possible work-around to this problem. If you have a user
form that the macro calls prior to the open workbook command, it breaks the shift problem and will continue to run the macro after the file opens. "Dave Peterson" wrote: If you open a workbook with the shift key held down, then excel thinks you don't want to run the auto_open or workbook_open procedures. And since your shortcut key includes the shift key, it's confusing excel and excel thinks you want to stop. Remove the shift key from your shortcut key and try it out. Ted M H wrote: Running Excel 2007 under WinXPPro I wrote four macros. The first three each do a specific funtion and are named NameStateSum1, 2 and 3. The fourth one is named NameStateSum (no suffix) and it simply runs the three numbered macros in order. The parent macro is set up to run on CNTL+SHFT+N If I run the parent macro from the developer tab, it runs fine. When I try to run it with the shortcut keys, it executes only the first of three submacros and stops. Any idea what's causing this and how I can make it work with the shortcut keys? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Event Macro running another macro inside | Excel Discussion (Misc queries) | |||
disable user running macro from Tools Macro | Excel Discussion (Misc queries) | |||
Macro not working properly when the file is shared | Excel Worksheet Functions | |||
Macro "1 tall/1 wide" not working properly | Excel Worksheet Functions | |||
Excel 2000 running on Windows XP SP2 does not properly open CSV fi | Excel Discussion (Misc queries) |