ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create formulas with $Rn1Cn2:$Rn1Cn3 format (https://www.excelbanter.com/excel-programming/282915-create-formulas-%24rn1cn2-%24rn1cn3-format.html)

Michael D. Ober[_2_]

Create formulas with $Rn1Cn2:$Rn1Cn3 format
 
I need to have VBA create formulas with mixed referencing such as:

=SUM($G10:$G20)

I can create =SUM($G$10:$G$20) and =SUM(G10:G20), neither of which is what I
need.

Thanks,
Mike.



Bob Phillips[_6_]

Create formulas with $Rn1Cn2:$Rn1Cn3 format
 
Mike,

Have you tried something like

ActiveCell.FormulaR1C1 = "=SUM(R[10]C7:R[20]C7)"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Michael D. Ober" <[email protected] wrote in message
...
I need to have VBA create formulas with mixed referencing such as:

=SUM($G10:$G20)

I can create =SUM($G$10:$G$20) and =SUM(G10:G20), neither of which is what

I
need.

Thanks,
Mike.





Don Guillett[_4_]

Create formulas with $Rn1Cn2:$Rn1Cn3 format
 
Sub makeformula()
[n5].Formula = "=SUM($G10:$G20)"
'[n5].Formula =[n5].value'to chg to value
End Sub


--
Don Guillett
SalesAid Software

"Michael D. Ober" <[email protected] wrote in message
...
I need to have VBA create formulas with mixed referencing such as:

=SUM($G10:$G20)

I can create =SUM($G$10:$G$20) and =SUM(G10:G20), neither of which is what

I
need.

Thanks,
Mike.





Don Guillett[_4_]

Create formulas with $Rn1Cn2:$Rn1Cn3 format
 
Sorry, You said r1c1

--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
Sub makeformula()
[n5].Formula = "=SUM($G10:$G20)"
'[n5].Formula =[n5].value'to chg to value
End Sub


--
Don Guillett
SalesAid Software

"Michael D. Ober" <[email protected] wrote in message
...
I need to have VBA create formulas with mixed referencing such as:

=SUM($G10:$G20)

I can create =SUM($G$10:$G$20) and =SUM(G10:G20), neither of which is

what
I
need.

Thanks,
Mike.







Tom Ogilvy

Create formulas with $Rn1Cn2:$Rn1Cn3 format
 
sStr = "=SUM(G10:G20)"
? application.ConvertFormula(sStr,xlA1,xlA1,xlAbsRow RelColumn)
=SUM(G$10:G$20)
? application.ConvertFormula(sStr,xlA1,xlA1,xlRelRow AbsColumn)
=SUM($G10:$G20)

--
Regards,
Tom Ogilvy


Michael D. Ober <[email protected] wrote in message
...
I need to have VBA create formulas with mixed referencing such as:

=SUM($G10:$G20)

I can create =SUM($G$10:$G$20) and =SUM(G10:G20), neither of which is what

I
need.

Thanks,
Mike.






All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com