View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
john-lau john-lau is offline
external usenet poster
 
Posts: 10
Default Macro for absolute reference

Hello,

I have one excel book , which have 30 sheets (28 sheets are named as different
account manager's name),
1 sheet name as "summary" , last sheet name as "system data"

I would like to use macro to change relative reference to absolute reference
(only column absolute!!) on sheet"summary".
May I ask how to modify the following code to achieve absolute reference
:column). Thanks

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