Mixed absolue & relative formula through vba

TryingToLearn

Well-known Member
Joined
Sep 10, 2003
Messages
733
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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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