View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
S Himmelrich S Himmelrich is offline
external usenet poster
 
Posts: 76
Default Calculating column 'J' and offsetting result in column 'L' onnext blank row (continue to end of sheet)

You are correct, and that is the result, however I'm not getting my
subtotal on that line.

On Feb 4, 12:09*pm, "Peter T" <peter_t@discussions wrote:
FormCell.Offset(0, 2) is two columns to the right.

Regards,
Peter T

"S Himmelrich" wrote in message

...



The code below is not calculating the correct column, which should be
"J", not L, where the results are place...not sure what I've done.


* * With wks
* * * * Set myRng = Nothing
* * * * On Error Resume Next
* * * * Set myRng = .Range("J1", .Cells(.Rows.Count, "J").End(xlUp))
_
* * * * * * * * * * * * .Cells.SpecialCells(xlCellTypeConstants)
* * * * On Error GoTo 0


* * * * If myRng Is Nothing Then
* * * * * * MsgBox "no constants"
* * * * * * Exit Sub
* * * * End If


* * * * 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, 2).Value = .Value
* * * * * * * * .Offset(0, 2).Font.Bold = True
* * * * * * * * .FormulaR1C1 = ""
* * * * * * End With
* * * * Next myArea
* * End With- Hide quoted text -


- Show quoted text -