I have this column of string integers in the \'general\' type all the time. Every time I open this spreadsheet, I have to convert it into \'number\' type. But when I do it,
wrote a tiny macro
Sub PERS_FormatSelectionToNumberNoDecimals()
Selection.NumberFormat = "0"
End Sub
... in my PERSONAL.XLSB.
In my data workbook's ThisWorkbook module (VBA editor) I place a function
Private Sub Workbook_Activate()
' Purpose : assign key shortcuts when workbook is activated
Application.OnKey "^+o", "PERSONAL.XLSB!PERS_FormatSelectionToNumberNoDecimals"
End Sub
... to assign the shortcut key CTRL-SHIFT-O (O as in other; you may assign another key of your choice) to the macro.
=> whenever you need to re-format a range to Number with 0 decimals, select the range and press the shortcut key.
In order to get rid of the key assignment when switching to another workbook you may place
Private Sub Workbook_Deactivate()
' Purpose : removes key short cut assignments if workbook is deactivated
Application.OnKey "^+o"
End Sub
...in my data workbook's ThisWorkbook module (VBA editor)