Forum Discussion

AlexProfile's avatar
AlexProfile
Copper Contributor
Mar 18, 2023

Shortcut Key for Converting Value In Cell to Absolute Value

In Office Home & Student 2021, I need an absolute value shortcut key(s) to change many possibly negative numbers in a spreadsheet to absolute values.  A general search has yielded shortcuts, but they haven't worked.   Any ideas please.

4 Replies

  • AlexProfile 

    There is no built-in shortcut for this. You could create a macro in your personal macro workbook PERSONAL.XLSB and assign a custom keyboard shortcut to the macro.

    Sub Convert2Absolute()
        Dim rng As Range
        Dim cel As Range
        Application.ScreenUpdating = False
        On Error Resume Next
        Set rng = Selection.SpecialCells(xlCellTypeConstants, xlNumbers)
        If Not rng Is Nothing Then
            For Each cel In rng
                cel.Value = Abs(cel.Value)
            Next cel
        End If
        Application.ScreenUpdating = True
    End Sub

    Select a range before running the macro. Cells with formulas and cells that don't contain a number will be ignored by the macro.

    • AlexProfile's avatar
      AlexProfile
      Copper Contributor

      HansVogelaar 

      Hi,

      Thanks for the help.  I'm surprised they eliminated shortcuts for this, which apparently existed in earlier versions of Excel.

      thanks again,

      Alex Phillips

       

Resources