ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using offset with FormulaR1C1 (https://www.excelbanter.com/excel-programming/404132-using-offset-formular1c1.html)

S Himmelrich

using offset with FormulaR1C1
 
This code works, but I'm having an issue with providing a value copy
of the FormulaR1C1 the another column in the same row. I've basically
indicated the line of code that is not working.

For Each myArea In myRng.Areas
myFormula = "=sum(r[-1]c:r[-" & myArea.Cells.Count & "]c)"
Set FormCell = myArea.Cells(myArea.Cells.Count).Offset(1,
0)
With FormCell
.FormulaR1C1 = myFormula
.Offset(0, 1).FormulaR1C1 = myFormula <- This is the
problem line, I want to put the value myFormula
' .Offset(0, 3).FormulaR1C1 = myFormula
End With
Next myArea


Dave Peterson

using offset with FormulaR1C1
 
Do you mean you want the value for the .offset(0,1) column or do you want the
value from the column to the left?

with .offset(0,1)
.formular1c1 = myformula
.value = .value
end with

or
.offset(0,1).value = .value



S Himmelrich wrote:

This code works, but I'm having an issue with providing a value copy
of the FormulaR1C1 the another column in the same row. I've basically
indicated the line of code that is not working.

For Each myArea In myRng.Areas
myFormula = "=sum(r[-1]c:r[-" & myArea.Cells.Count & "]c)"
Set FormCell = myArea.Cells(myArea.Cells.Count).Offset(1,
0)
With FormCell
.FormulaR1C1 = myFormula
.Offset(0, 1).FormulaR1C1 = myFormula <- This is the
problem line, I want to put the value myFormula
' .Offset(0, 3).FormulaR1C1 = myFormula
End With
Next myArea


--

Dave Peterson

S Himmelrich

using offset with FormulaR1C1
 
Super - .offset(0,1).value = .value

on the same line of code is there a way to put BOLD formatting?


On Jan 11, 5:08*pm, Dave Peterson wrote:
Do you mean you want the value for the .offset(0,1) column or do you want the
value from the column to the left?

* * * with .offset(0,1)
* * * * * .formular1c1 = myformula
* * * * * .value = .value
* * * end with

or
* * *.offset(0,1).value = .value



S Himmelrich wrote:

This code works, but I'm having an issue with providing a value copy
of the FormulaR1C1 the another column in the same row. *I've basically
indicated the line of code that is not working.


For Each myArea In myRng.Areas
* * * * * * myFormula = "=sum(r[-1]c:r[-" & myArea.Cells..Count & "]c)"
* * * * * * Set FormCell = myArea.Cells(myArea.Cells.Count).Offset(1,
0)
* * * * * * With FormCell
* * * * * * * * .FormulaR1C1 = myFormula
* * * * * * * * .Offset(0, 1).FormulaR1C1 = myFormula * <- This is the
problem line, I want to put the value myFormula
* * * * ' * * * *.Offset(0, 3).FormulaR1C1 = myFormula
* * * * * * End With
* * * * Next myArea


--

Dave Peterson



Dave Peterson

using offset with FormulaR1C1
 
..offset(0,1).value = .value
..offset(0,1).font.bold = true

Lots of times, it's quicker to record a macro when you do it manually.

S Himmelrich wrote:

Super - .offset(0,1).value = .value

on the same line of code is there a way to put BOLD formatting?

On Jan 11, 5:08 pm, Dave Peterson wrote:
Do you mean you want the value for the .offset(0,1) column or do you want the
value from the column to the left?

with .offset(0,1)
.formular1c1 = myformula
.value = .value
end with

or
.offset(0,1).value = .value



S Himmelrich wrote:

This code works, but I'm having an issue with providing a value copy
of the FormulaR1C1 the another column in the same row. I've basically
indicated the line of code that is not working.


For Each myArea In myRng.Areas
myFormula = "=sum(r[-1]c:r[-" & myArea.Cells.Count & "]c)"
Set FormCell = myArea.Cells(myArea.Cells.Count).Offset(1,
0)
With FormCell
.FormulaR1C1 = myFormula
.Offset(0, 1).FormulaR1C1 = myFormula <- This is the
problem line, I want to put the value myFormula
' .Offset(0, 3).FormulaR1C1 = myFormula
End With
Next myArea


--

Dave Peterson


--

Dave Peterson


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

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