+ Reply to Thread
Results 1 to 6 of 6

What kind of "range" does WorksheetFunction.Max need?

  1. #1
    Registered User
    Join Date
    09-23-2007
    Posts
    54

    What kind of "range" does WorksheetFunction.Max need?

    Starnge problem here (maybe my dumb error...)

    This works:
    Please Login or Register  to view this content.
    This doesn't:
    Please Login or Register  to view this content.
    I need variable columns and rows, that's why I need the 2nd style. At the beginning I Dim B1var() As Variant and then again ReDim B1var(1 To numbldsec) where numbldsec is an integer, but not sure that matters. startrow and endrow are not declared, but check out as integers.....

    Any ideas?
    Last edited by jeffreybrown; 11-18-2012 at 09:22 PM. Reason: As per Forum Rule #3, please use code tags…Thanks.

  2. #2
    Registered User
    Join Date
    11-16-2012
    Location
    Crownpoint, New Mexico
    MS-Off Ver
    All.
    Posts
    59

    Re: What kind of "range" does WorksheetFunction.Max need?

    Well, in your second msgbox B1var(i) startrow and B1var(i) endrow are the same number. ie. B1var(i) has the same value in both spots.

    ReDim'ing the variant does not cause there to be two separate values for B1var(i). You need a second variant, or you need another count variable other than 'i'.

    (I Think)
    Please click * to add to my reputation!

  3. #3
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,885

    Re: What kind of "range" does WorksheetFunction.Max need?

    Isn't it something about that you need to select the worksheet first if you gonna use the Cells function?
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: What kind of "range" does WorksheetFunction.Max need?

    You also should qualify each Cells statement with its own worksheet reference.

    Please Login or Register  to view this content.

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,960

    Re: What kind of "range" does WorksheetFunction.Max need?

    How are you filling "B1var"?
    Ben Van Johnson

  6. #6
    Registered User
    Join Date
    09-23-2007
    Posts
    54

    Re: What kind of "range" does WorksheetFunction.Max need?

    AlphaFrog, your suggestion worked. I just needed to get the min's and max's of each column, as the column number i changed. Also the start and end rows for each column are variable. B1var array are just row numbers.

+ 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