Macro for absolute reference
Hi Gord,
Would you explain to me the following piece of this code? I gather that it increments which rel/abs option is applied (right?). But i dont really understand the mechanics of how or why it does so.
"absRelMode = (absRelMode Mod 4) + 1"
Thanks,
Tyler
Sub CycleAbsRel()
Dim inRange as Range, oneCell As Range
Static absRelMode As Long
absRelMode = (absRelMode Mod 4) + 1
Set inRange = Selection.SpecialCells(xlCellTypeFormulas)
If Not (inRange Is Nothing) Then
For Each oneCell In inRange
With oneCell
.FormulaR1C1 = Application.ConvertFormula(.FormulaR[1]C1, xlR1C1, xlR1C1,
absRelMode, oneCell)
End With
Next oneCell
End If
End Sub
|