I have created a macro like this
it works fine when i run it manually from developer/ macro
but when i press the keyboard shortcut it stop before line 18 with no error given
VBA Code:
Set x = ActiveWorkbook
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Workbooks.Open Filename:="C:\Users\{user}\Desktop\GP MACRO\Bulk inventory adjustment.xlsx"
Windows("Bulk inventory adjustment.xlsx").Activate
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Delete
With x.Activate
Selection.Copy
End With
Windows("Bulk inventory adjustment.xlsx").Activate
Range("A1").Select
ActiveSheet.Paste
ActiveWorkbook.Save
Windows("Bulk inventory adjustment.xlsx").Close
With x.Activate
Dim xFullName As String
xFullName = Application.ActiveWorkbook.FullName
ActiveWorkbook.Saved = True
Application.ActiveWorkbook.ChangeFileAccess xlReadOnly
Kill xFullName
Application.ActiveWorkbook.Close False
End With
it works fine when i run it manually from developer/ macro
but when i press the keyboard shortcut it stop before line 18 with no error given