Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Change formulas from relative addressing to absolute?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Portwood - 30 May 2008 00:26 GMT
I have a large range which contains formulas that use absolute addressing as
opposed to relative. I would like to change these formulas to relative
addressing by adding $ before the row/column indicators. For example, I
would like to change formulas like:

=[C:\MyDirectory\MyWorkbook.xls]'Survey Count'!A4

to

=[C:\MyDirectory\MyWorkbook.xls]'Survey Count'!$A$4

This would apply to all cells in the range.

The above examples are supposed to be recognizable as external links. My
syntax may be off, since I am no guru and I am typing this at home from
memory. The important thing is that the formulas refer to individual cells,
not ranges of cells, which I hope would make the job easier, if it is
possible at all.

Is there a way to do this? Do I need a macro? Any help would be appreciated.

Thanks in advance,
David Portwood
Gord Dibben - 30 May 2008 00:40 GMT
Here is a set of macros for changing cell references.

Sub Absolute()
Dim Cell As Range
   For Each Cell In Selection
       If Cell.HasFormula Then
           Cell.Formula = Application.ConvertFormula _
           (Cell.Formula, xlA1, xlA1, xlAbsolute)
       End If
   Next
End Sub

Sub AbsoluteRow()
Dim Cell As Range
   For Each Cell In Selection
       If Cell.HasFormula Then
           Cell.Formula = Application.ConvertFormula _
           (Cell.Formula, xlA1, xlA1, xlAbsRowRelColumn)
       Next
   End Sub
   
Sub AbsoluteCol()
Dim Cell As Range
   For Each Cell In Selection
       If Cell.HasFormula Then
           Cell.Formula = Application.ConvertFormula _
           (Cell.Formula, xlA1, xlA1, xlRelRowAbsColumn)
       Next
   End Sub

Sub Relative()
Dim Cell As Range
   For Each Cell In Selection
       If Cell.HasFormula Then
           Cell.Formula = Application.ConvertFormula _
           (Cell.Formula, xlA1, xlA1, xlRelative)
       Next
   End Sub

Gord Dibben  MS Excel MVP

>I have a large range which contains formulas that use absolute addressing as
>opposed to relative. I would like to change these formulas to relative
[quoted text clipped - 19 lines]
>Thanks in advance,
>David Portwood
David Portwood - 31 May 2008 15:55 GMT
Your code worked very well. Thank you, Gord.

> Here is a set of macros for changing cell references.
>
[quoted text clipped - 63 lines]
>>Thanks in advance,
>>David Portwood
Gary Keramidas - 30 May 2008 01:08 GMT
weird, but somebody else posted a similar question about 5 hours before.
Signature


Gary

>I have a large range which contains formulas that use absolute addressing as
>opposed to relative. I would like to change these formulas to relative
[quoted text clipped - 19 lines]
> Thanks in advance,
> David Portwood
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.