1

I've made a bunch of shortcuts to format numbers, as follows. All of them work, except the Ctrl+Shift+5, Ctrl+Shift+6 and Ctrl+Shift+7 shortcuts. The problem seems to be with the shortcut keys, because if I try to use another key (Ctrl+Shift 1, 2, 3), with the same function, then it works.

Application.OnKey "^+v", "pasteValues"
Application.OnKey "^+1", "'formatAs""" & "number" & """'"
Application.OnKey "^+2", "'formatAs""" & "number2" & """'"
Application.OnKey "^+3", "'formatAs""" & "date" & """'"
Application.OnKey "^+5", "'formatAs""" & "percentage" & """'"
Application.OnKey "^+6", "'formatAs""" & "percentage2" & """'"
Application.OnKey "^+7", "'formatAs""" & "general" & """'"

I've also re-ran the function that sets the keyboard shortcuts, in case any add-in or something was overriding my shortcuts.

Any ideas?

1 Answer 1

1

Those are already assigned, see kb

Ctrl+Shift+% Applies the Percentage format with no decimal places.

Ctrl+Shift+^ Applies the Scientific number format with two decimal places.

Ctrl+Shift+& Applies the outline border to the selected cells.

3
  • But can't I overwrite them? For example, Ctrl+Shift+! "Applies the Number format with two decimal places, thousands separator, and minus sign (-) for negative values.", but I could override it.
    – pedropais
    Jun 3, 2015 at 15:10
  • Are you sure your macro overrides it? What errors do you get for some that you don't get for others? Jun 3, 2015 at 15:20
  • Application.OnKey "^+1", "'formatAs""" & "number" & """'" > works as intended when Ctrl+Shift+! is pressed. Application.OnKey "^+5", "'formatAs""" & "percentage" & """'" > doesn't do anything when Ctrl+Shift+% is pressed. I even added a breakpoint on the formatAs function, but it's not called on the 2nd case.
    – pedropais
    Jun 3, 2015 at 16:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .