+ Reply to Thread
Results 1 to 4 of 4

change the number of rows to a variable

  1. #1
    Registered User
    Join Date
    08-11-2005
    Posts
    21

    change the number of rows to a variable

    Now, the number of rows in 'Data' sheet is 3938, so the function is:
    =SUMPRODUCT((Data!G2:G3938=7100)*(Data!B2:B3938=1000)*(Data!O2:O3938=2)*(Data!C2:C3938))

    If I don't know the number of rows is 3938, what should I do to accomplish the same function.

  2. #2
    Registered User
    Join Date
    06-29-2005
    Posts
    46
    Use:
    ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row

    This returns the number of the last used row in a worksheet

  3. #3
    Registered User
    Join Date
    07-05-2005
    Posts
    11
    You could create a macro that when activated gives you the number of rows.

    Dim i as integer

    i = 0

    Do until ActiveCell = ""
    ActiveCell.Offset(1,0).Select
    i = i +1
    Loop

    'At this point choose any cell that you want that value to be returned to
    'for example
    Range("D1").Value = i

    I hope that this helps.

    theguz

  4. #4
    Registered User
    Join Date
    08-11-2005
    Posts
    21
    How to combine this into the sumproduct function in the original post? Thanks for your help.

    Quote Originally Posted by Raman325
    Use:
    ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row

    This returns the number of the last used row in a worksheet

+ 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