我想创建一个宏,如果有一个公式,将$ $放在一个单元格中,但现在我只能为两者做,例如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.