Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 83
Default Shortcut key not running macro properly

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 95
Default Shortcut key not running macro properly

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 83
Default Shortcut key not running macro properly

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Shortcut key not running macro properly

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 83
Default Shortcut key not running macro properly

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Shortcut key not running macro properly

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Event Macro running another macro inside K1KKKA Excel Discussion (Misc queries) 1 December 20th 06 08:21 PM
disable user running macro from Tools Macro Steve Simons Excel Discussion (Misc queries) 4 September 28th 06 06:28 AM
Macro not working properly when the file is shared Chakri Excel Worksheet Functions 0 August 30th 06 01:33 PM
Macro "1 tall/1 wide" not working properly gizmo Excel Worksheet Functions 2 January 10th 05 07:18 PM
Excel 2000 running on Windows XP SP2 does not properly open CSV fi Oscar Excel Discussion (Misc queries) 1 December 20th 04 10:10 PM


All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"