Mixed absolue & relative formula through vba

TryingToLearn

Well-known Member
Joined
Sep 10, 2003
Messages
730
My project has many named ranges and I'm creating formulas in various cells based on their addresses. The issue is these evaluate to absolute formulas where I need mixed. Is there any way to accomplish this?
example:
Code:
tgtF = "=" & Range(Cells(Target.Row, _
    Range("runbal").Column).Address).Address & "+" & "Sum(" & OutRng.Address & ")"
evaluates to: =$G$149+SUM($I$135:$I$149)
Then:
Code:
tgtF.Formula = Application.ConvertFormula(tgtF.Formula, xlA1, xlA1, xlRelative)
results in: =G149+SUM(I135:I149)

Is there any way through VBA I can end up with: =G149+SUM(I$135:I149)
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
tgtF.Formula = "=" & Cells(Target.Row, Range("runbal").Column).Address(0, 0) & "+" & "Sum(" & OutRng(1).Address(1, 0) & ":" & OutRng(OutRng.Cells.Count).Address(0, 0) & ")"
 
Upvote 0
tgtF.Formula = "=" & Cells(Target.Row, Range("runbal").Column).Address(0, 0) & "+" & "Sum(" & OutRng(1).Address(1, 0) & ":" & OutRng(OutRng.Cells.Count).Address(0, 0) & ")"

The simple things we don't know to even look for!!! Thank you, thank you!
 
Upvote 0

Forum statistics

Threads
1,215,581
Messages
6,125,656
Members
449,246
Latest member
jbbtz28

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top