frisbeenut
Member
The code below will change all formulas in a sheet to relative row and absolute column style references.
I would like this function to work on only selected cells. Perhaps using an intersect function of two ranges.
The first range being the cells selected, and the second range being the range returned by .Cells.SpecialCells function.
Or maybe there is another simpler more direct way of doing this with VBA.
Thanks so much for any assistance.
I would like this function to work on only selected cells. Perhaps using an intersect function of two ranges.
The first range being the cells selected, and the second range being the range returned by .Cells.SpecialCells function.
Or maybe there is another simpler more direct way of doing this with VBA.
Thanks so much for any assistance.
Code:
'The code below will change all formulas in a sheet to relative row and absolute column style references.
'
'oCell.Formula = Application.ConvertFormula(oCell.Formula, xlA1, xlA1, 1)
'oCell.Formula = Application.ConvertFormula(oCell.Formula, xlA1, xlA1, xlAbsolute)
'xlAbsolute 1 Convert to absolute row and column style.
'xlAbsRowRelColumn 2 Convert to absolute row and relative column style.
'xlRelRowAbsColumn 3 Convert to relative row and absolute column style.
'xlRelative 4 Convert to relative row and column style.
'
Sub convertFormulasToAbsoluteCol()
Dim oCell As Range
With ActiveSheet
For Each oCell In .Cells.SpecialCells(Type:=xlCellTypeFormulas)
oCell.Formula = Application.ConvertFormula(oCell.Formula, xlA1, xlA1, 3)
Next
End With