Is is possible to get Excel to insert an absolute reference when clicking on cells to build a formula?
Click the cell and then hit F4. As you keep hitting F4, it will cycle through various level of absolute.
Example:
- Click the cell A1, type '=', then click the cell B1.
- Hit F4. The reference to B1 becomes $B$1.
- Hit F4 again. The reference becomes B$1.
- Hit F4 again. The reference becomes $B1.
- Hit F4 again. The reference returns to B1.
I've just been through a similar issue where I needed to do this for a large number of cells ad-hoc
And this code saved my sanity :)
Sub selectedToAbsolute()
Dim c As Variant
For Each c In Selection
c.Value = Application.ConvertFormula(c.Formula, xlA1, , xlAbsolute)
Next c
End Sub
Sub selectedToRelative()
Dim c As Variant
For Each c In Selection
c.Value = Application.ConvertFormula(c.Formula, xlA1, , xlRelative, c)
Next c
End Sub