+ Reply to Thread
Results 1 to 5 of 5

Reference Last Row in Sumif VBA

Hybrid View

jeffreybrown Reference Last Row in Sumif... 03-20-2009, 04:56 PM
shg Re: Reference Last Row in... 03-20-2009, 05:01 PM
jeffreybrown Re: Reference Last Row in... 03-20-2009, 05:05 PM
VBA Noob Re: Reference Last Row in... 03-20-2009, 05:17 PM
jeffreybrown Re: Reference Last Row in... 03-20-2009, 05:47 PM
  1. #1
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Reference Last Row in Sumif VBA

    Hi,

    I recorded this sumif in VBA, but know I am trying to figure out how to tie in the last row reference in place of the 27. Can somebody help with this?

    =SUMIF($AR$2:$AR$27,$AR29,AS$2:AS$27)
    FormulaR1C1 = "=SUMIF(R2C44:R27C44,RC44,R2C:R27C)"
    Last edited by VBA Noob; 03-20-2009 at 05:59 PM.
    HTH
    Regards, Jeff

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Reference Last Row in Sumif VBA

    Last row reference?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Reference Last Row in Sumif VBA

    Yes, my macro will add rows at each change in another value in the data so my sumif might be last row 27 one time and then the next time it could be last row 53.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Reference Last Row in Sumif VBA

    One way

    Dim LastRow As Long
        LastRow = Cells(Rows.Count, "A").End(xlUp).Row
        ActiveCell.Formula = _
        "=SUMIF($AR$2:$AR$" & LastRow & ",$AR29,AS$2:AS$" & LastRow & ")"
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Post Re: Reference Last Row in Sumif VBA

    Thank you...that's exactly it

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1