Consulting

Results 1 to 5 of 5

Thread: Have Excel identify last entry in a range

  1. #1
    VBAX Regular
    Joined
    Apr 2007
    Posts
    6
    Location

    Red face Have Excel identify last entry in a range

    I have a checkbook registry type of spreadsheet, it includes a running balance column. I need Excel to look in that range (RunningBalance) and find the last entry posted; after it finds it I need it to put it in another cell, i.e., Cell H2 would equal the last value in the range RunningBalance. then I could take H2 on all the sheets and total them on the Summary Sheet.

    My goal is to have a different registry sheet for each pot of money and on a summary sheet sum the current balance on each sheet. Of course the problem is that as you enter transactions on each sheet the cell with the current balance moves as well.

    Excel has to have the capability of doing this! I just don't know how.

    Thanks in advance for your help.

    aaghd

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    H2: =LOOKUP(99^99,A:A)
    ____________________________________________
    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
    VBAX Mentor tstav's Avatar
    Joined
    Feb 2008
    Location
    Athens
    Posts
    350
    Location
    Can this help you get it going? This is psuedocode (it won't run by itself)
    You place everything in the ThisWorkbook code module

    [vba]Option Explicit
    Private Sub Workbook_Open()
    For every Sheet In Worksheets
    If Sheet name <> "Summary" Then
    ("H2").Value = Sheet.Cells(Sheet.Rows.Count, 1).End(xlUp).Value
    Total = Total + ("H2").Value
    End If
    Next
    Worksheets("Summary").("D1").Value = Total 'Change D1 with the cell you want to show the total
    End Sub
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    If Target.Column = 1 Then 'Place here the column of your data
    Sheet.("H2").Value = Sheet.Cells(Sheet.Rows.Count, 1).End(xlUp).Value' change 1 with the column of your data
    For every Sheet In Worksheets
    Total = Total + Sheet.("H2").Value
    Next
    Worksheets("Summary").("D1").Value = Total 'Change D1 with the cell you want to show the total
    End If
    End Sub[/vba]
    He didn't know it was impossible, so he did it. (Jean Cocteau)

  4. #4
    VBAX Regular
    Joined
    Apr 2007
    Posts
    6
    Location

    Brilliant - Thanks so much - It worked like a champ.

    Quote Originally Posted by xld
    H2: =LOOKUP(99^99,A:A)


    from
    KIS

  5. #5
    VBAX Regular
    Joined
    Apr 2007
    Posts
    6
    Location
    Thanks for the code. I am sure that I will find it useful. Code is soooo cool!

    Have a great evening,

    KIS

Posting Permissions

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