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.

Update References To Absolute

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ScottS - 29 May 2008 19:33 GMT
I have a situation where users have long formulas with external references.  
I need to convert them to absolute.

I tried using this code but it resulted in VALUE# errors

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

Here's an example of a formula I need it to work with.

CHOOSE($C$1,'O:\EVERYONE\User\Reporting\[Data
File.xls]Actual'!F620,'O:\EVERYONE\User\Reporting\[Data
File.xls]Actual'!G620,'O:\EVERYONE\User\Reporting\[Data
File.xls]Actual'!H620,'O:\EVERYONE\User\Reporting\[Data
File.xls]Actual'!I620,'O:\EVERYONE\User\Reporting\[Data
File.xls]Actual'!J620,'O:\EVERYONE\User\Reporting\[Data
File.xls]Actual'!K620,'O:\EVERYONE\User\Reporting\[Data
File.xls]Actual'!L620,'O:\EVERYONE\User\Reporting\[Data
File.xls]Actual'!M620,'O:\EVERYONE\User\Reporting\[Data
File.xls]Actual'!N620,'O:\EVERYONE\User\Reporting\[Data
File.xls]Actual'!O620,'O:\EVERYONE\User\Reporting\[Data
File.xls]Actual'!P620,'O:\EVERYONE\User\Reporting\[Data File.xls]Actual'!Q620)

Thanks in advance for your help.

Signature

Scott S

Gary Keramidas - 29 May 2008 21:28 GMT
don't know about your formula because i don't have all of those references,  but
this worked for me, with a formula in C1

range("D1")=
application.ConvertFormula(range("C1").Formula,xlA1,xla1,xlabsolute)

=Sheet2!B1+A1

changes to

=Sheet2!$B$1+$A$1
Signature


Gary

>I have a situation where users have long formulas with external references.
> I need to convert them to absolute.
[quoted text clipped - 27 lines]
>
> Thanks in advance for your help.
 
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.