Thread: Formual Issue
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Roger Govier Roger Govier is offline
external usenet poster
 
Posts: 2,886
Default Formual Issue

Hi John

Can't see why i delected G22 either.

Glad it just wasn't me!!!

Thanks for the feedback, pleased you got it to work

--
Regards

Roger Govier


"John" wrote in message
...
Can't see why i delected G22 either. Your formula worked spot on
though.

Cheers Roger

"Roger Govier" wrote:

Hi John

I can't see why you are selecting G22, but wanting the formula to run
from G5.

Try the following

Sub test4()
Dim lr As Long
Range("G5").Select
lr = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row
Cells(Rows.Count, ActiveCell.Column).End(xlUp)(3).Select
ActiveCell.Formula = "=Sum(" & "G5:G" & lr & ")"

End Sub

Amend to suit
--
Regards

Roger Govier


"John" wrote in message
...
Hi,

Simple formula to insert a SUM.

Range("G22").Select
Selection.End(xlDown).Select
ActiveCell.Offset(2, 0).Select
ActiveCell.FormulaR1C1 = "=SUM(G5:R[-2]C)"

But it returns in Excel......=SUM('G5':G124)
which doesn't work.

Any idea?

Thanks John