Macro shortcut insert column failure

Hi all, Hopefully this is a straightforward issue…. I have a macro which works fine when run via view macros but when the shortcut key is used to run it, the following line to insert a column always results in an error. is there something wrong with the code?

Thanks in advance!!!

Columns(“B:B”).Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove

Explorer Asked on 18th October 2017 in Excel for Windows.
Add Comment
  • 2 Answer(s)

    Shift key in the shortcut might be the problem.

    Please have a look at the below solutions:

    1. Remove Shift key from your shortcut and choose another one
    2. Instead of using .Open, you could use .Add which will do the same job, but the code won’t hang. So if you do Application.Workbooks.Add(yourPath) it should behave properly.

    Open and Add have the exact same behavior when you look at the screen while running the Macro.

    Intermediate Answered on 18th November 2017.
    Add Comment

    Thanks andy

    1. There is no shift in my shortcut. Jus ctrl and a letter
    2. There is no Open or Add in my code

    Explorer Answered on 18th November 2017.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of use.