Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Macro shortcut keys not work properly

I added to my macro a shortcut key & for some reason it oprate only part of my macro. If anyone familiar with this kind of problem, I would like a solution

This is my macro


' Ctrl+Shift+T shortcu

Sub FindSheets(
Dim FName As Strin
Dim WB As Workboo
Const FOLDER_NAME = "C:\Temp" '<<--CHANG

ChDrive FOLDER_NAM
ChDir FOLDER_NAM
FName = Dir("*.xls"
Workbooks.Add ' New W
Application.DisplayAlerts = False ' Disable delete alert
Sheets("Sheet3").Select 'Delete sheet #3 in new W
ActiveWindow.SelectedSheets.Delet
Sheets("Sheet2").Select 'Delete sheet #2 in new W
ActiveWindow.SelectedSheets.Delet
Application.DisplayAlerts = True ' Enable delete alert
ChDir "C:\Documents and Settings\mlunker\Desktop" ' Save new W
ActiveWorkbook.SaveAs Filename:=
"C:\Documents and Settings\mlunker\Desktop\TempName.xls", FileFormat:=
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False
, CreateBackup:=Fals
Application.DisplayAlerts = Tru
Do Until FName = "" ' copy sheet
Set WB = Workbooks.Open(Filename:=FName
ActiveSheet.Selec
n = Workbooks("TempName.xls").Sheets.Coun
ActiveSheet.Copy After:=Workbooks("TempName.xls").Sheets(n
WB.Close SaveChanges:=Tru
FName = Dir(
Loo
Windows("TempName.xls").Activat
Application.DisplayAlerts = False ' Disable delete alert
Sheets("Sheet1").Select 'Delete sheet #2 in new W
ActiveWindow.SelectedSheets.Delet
Application.CutCopyMode = Fals
ActiveWorkbook.Sav
Application.DisplayAlerts = True ' Enable delete alert
End Su

Thanks
Mata

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro shortcut keys not work properly

Try changing the shortcut key combination so it doesn't include a Shift.

--
Regards,
Tom Ogilvy


"Matan" wrote in message
...
I added to my macro a shortcut key & for some reason it oprate only part

of my macro. If anyone familiar with this kind of problem, I would like a
solution.

This is my macro:

'
' Ctrl+Shift+T shortcut
'
Sub FindSheets()
Dim FName As String
Dim WB As Workbook
Const FOLDER_NAME = "C:\Temp" '<<--CHANGE

ChDrive FOLDER_NAME
ChDir FOLDER_NAME
FName = Dir("*.xls")
Workbooks.Add ' New WB
Application.DisplayAlerts = False ' Disable delete alerts
Sheets("Sheet3").Select 'Delete sheet #3 in new WB
ActiveWindow.SelectedSheets.Delete
Sheets("Sheet2").Select 'Delete sheet #2 in new WB
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True ' Enable delete alerts
ChDir "C:\Documents and Settings\mlunker\Desktop" ' Save new WB
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\mlunker\Desktop\TempName.xls",

FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",

ReadOnlyRecommended:=False _
, CreateBackup:=False
Application.DisplayAlerts = True
Do Until FName = "" ' copy sheets
Set WB = Workbooks.Open(Filename:=FName)
ActiveSheet.Select
n = Workbooks("TempName.xls").Sheets.Count
ActiveSheet.Copy After:=Workbooks("TempName.xls").Sheets(n)
WB.Close SaveChanges:=True
FName = Dir()
Loop
Windows("TempName.xls").Activate
Application.DisplayAlerts = False ' Disable delete alerts
Sheets("Sheet1").Select 'Delete sheet #2 in new WB
ActiveWindow.SelectedSheets.Delete
Application.CutCopyMode = False
ActiveWorkbook.Save
Application.DisplayAlerts = True ' Enable delete alerts
End Sub

Thanks,
Matan



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
macro will not run with shortcut keys Doug Excel Worksheet Functions 0 December 4th 09 07:41 PM
macros shortcut keys don't work Doug New Users to Excel 0 November 18th 09 03:04 PM
Shortcut key not running macro properly Ted M H Excel Discussion (Misc queries) 5 October 1st 08 11:07 PM
My Word shortcut keys for Windings won't work in Excel Mulberry Excel Discussion (Misc queries) 5 February 20th 08 08:58 PM
macro shortcut keys don't work andr01d Excel Discussion (Misc queries) 1 February 3rd 06 05:40 PM


All times are GMT +1. The time now is 02:05 PM.

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"