Consulting

Results 1 to 3 of 3

Thread: Make formula equal to cell contents of last cell in a column

  1. #1

    Make formula equal to cell contents of last cell in a column

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    Dim rng As Range
    
        Set rng = Range(Range("I17"), Range("I17").End(xlUp))
        Range("I18").Formula = "=SUM(" & rng.Address(False, False) & ")"
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Thanks for the quick response. I figured it'd be an easy fix. Works perfect!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •