Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Update References To Absolute

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.

--
Scott S
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Update References To Absolute

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,xlA 1,xla1,xlabsolute)

=Sheet2!B1+A1

changes to

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


Gary


"ScottS" wrote in message
...
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.

--
Scott S



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert relative cell references to absolute cell references via amacro? Dave F[_2_] Excel Discussion (Misc queries) 1 May 15th 08 04:43 PM
Help with converting a block of cells with Absolute and mixed references to relative references Vulcan Excel Worksheet Functions 3 December 13th 07 11:43 PM
Absolute References [email protected] Excel Worksheet Functions 1 November 29th 06 12:41 AM
absolute references etc in VBA Hein[_6_] Excel Programming 3 April 10th 06 07:39 PM
Absolute references Johan Excel Programming 0 March 16th 06 09:08 PM


All times are GMT +1. The time now is 04:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"