PDA

View Full Version : [SOLVED] Make formula equal to cell contents of last cell in a column



rs33olol
03-08-2016, 12:39 PM
I don't use VB a ton and have always been able to get my way through. But this one has stumped me and it probably shouldn't. I need the last contents of a cell in a column. Just its value as it'd be a total. It'll only have about 5 to 12 rows in any given month but want the forumla to pick it up. I thought using a variable would work but what I have only brings me back with and answer of 1 or TRUE. Anyway, any help is appreciated on this for what should be rather simple. Thanks.

i = Range("i17").Select
Selection.End(xlUp).Select
Range("I18").Select
ActiveCell.Formula = "=sum(" & i & ")"
Range("I19").Select

xld
03-08-2016, 01:09 PM
Dim rng As Range

Set rng = Range(Range("I17"), Range("I17").End(xlUp))
Range("I18").Formula = "=SUM(" & rng.Address(False, False) & ")"

rs33olol
03-08-2016, 02:00 PM
Thanks for the quick response. I figured it'd be an easy fix. Works perfect!