I have this macro which was donated to me to help with my editing/updating of many formulas from Relative to Absolute, but the macro returns #VALUE! on all of my larger formulas. It seems to handle smaller formulas well, but the ones I really need it for it returns #VALUE! and clears the contents of the cell.
I'm hoping someone here can look this over for me and see if they can identify any reason it is behaving like this and if there are any changes I can make to have it work on my larger formulas.
I'm using Excel 2000
Thanks.
Option Explicit
Sub Change_Formulas_to_Absolute()
'Erik Van Geit
'051119
'change formulas to absolute
Dim Cell As Range
Dim RNG As Range
Dim AppSetCalc As Integer
Dim AppSetEnEv As Integer
On Error Resume Next
Set RNG = Selection.SpecialCells(xlCellTypeFormulas)
On Error GoTo 0
If RNG Is Nothing Then
MsgBox "No formulas found in selection", 48, "TITLE"
Exit Sub
End If
With Application
.ScreenUpdating = False
AppSetCalc = .Calculation
.Calculation = xlCalculationManual
AppSetEnEv = .EnableEvents
.EnableEvents = False
End With
For Each Cell In RNG
'Cell.Formula = Application.ConvertFormula(Cell.Formula, 1, 1, xlAbsolute)
'Cell.Formula = Application.ConvertFormula(Cell.Formula, 1, 1, xlAbsRowRelColumn)
'Cell.Formula = Application.ConvertFormula(Cell.Formula, 1, 1, xlRelRowAbsColumn)
Cell.Formula = Application.ConvertFormula(Cell.Formula, 1, 1, xlRelative)
Next Cell
With Application
.ScreenUpdating = True
.Calculation = AppSetCalc
.EnableEvents = AppSetEnEv
End With
End Sub
Bookmarks