Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

VBA Code not running properly

$
0
0

I am using the VBA code listed below as part of my Personal.xlsb. If I run the command from the spreadsheet via the shortcut key it does not perform all the steps. If I run the code via the play button in the VBA Editor and put stops in the VBA on every step it works perfectly.

The code I am using is;

Sub cupboard_key()
'
' cupboard_key Macro
'
' Keyboard Shortcut: Ctrl+Shift+K
'
    Workbooks.Open Filename:= _
        "W:\MAINTENANCE\Reference_Files\KeyCupboard_Eng.xlsx"
    Range("A1").Select
    Range("A1:I1292").Select
    Range("I1292").Activate
    Selection.ClearContents
    ActiveWindow.SmallScroll Down:=-1302
    Range("A1").Select
    ActiveWorkbook.Save
    Windows("Key List - June 2013.xlsx").Activate
    Range("B:B,C:C,E:E,G:G,H:H,I:I,J:J,K:K,L:L").Select
    Range("L1").Activate
    Selection.Copy
    Windows("KeyCupboard_Eng.xlsx").Activate
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("A1").Select
    Application.CutCopyMode = False
    ActiveWorkbook.Save
    ActiveWorkbook.Close
    Range("A1").Select
End Sub

Any ideas?

Thanks as always

T


Toni Chaffin aka Talisa


Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>