如何在公式中只输入左或右 $,

How to put only left or right $, in formula

我想创建一个宏,将左边的 $ 放在单元格中(如果有公式) 但现在我只能为两者做,例如 A2 ---> $A$2, 我如何修改我的代码以仅选择左或右符号? 谢谢!

这是我的代码

    Private Sub CommandButton3_Click()
'Absolute Fomula'
Dim c As Variant
Application.ScreenUpdating = False
For Each c In Selection
    If c.HasFormula = True Then
        c.Value = Application.ConvertFormula(c.Formula, xlA1, , xlAbsolute)
    End If
Next c
Application.ScreenUpdating = True
End

参见:

https://docs.microsoft.com/en-us/office/vba/api/excel.xlreferencetype

xlAbsolute

的替代品
Name                Value   Description
xlAbsolute          1       Convert to absolute row and column style.
xlAbsRowRelColumn   2       Convert to absolute row and relative column style.
xlRelative          4       Convert to relative row and column style.
xlRelRowAbsColumn   3       Convert to relative row and absolute column style.