+ Reply to Thread
Results 1 to 5 of 5

dealing with blank cells in a range

  1. #1
    steve
    Guest

    dealing with blank cells in a range

    i look for the max number in a range of codes in the following format:
    E06001
    E06002...

    here is a section of my code:

    Set rng = destWB.Worksheets("Sheet1").Range("D5:D" & Lr)

    rmax = Application.Evaluate("MAX(VALUE(RIGHT(" & _
    rng.Address(1, 1, xlA1, True) & _
    ",5)))")

    ****how can i tell it to ignore blank cells when looking for the max?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Steve,

    What impact do the blank cells have on determining the MAX value in the Range?

    Sincerely,
    Leith Ross

  3. #3
    Tom Ogilvy
    Guest

    Re: dealing with blank cells in a range

    rmax = Application.Evaluate("MAX(VALUE(RIGHT(""00000""&" & _
    rng.Address(1, 1, xlA1, True) & _
    ",5)))")

    Would probably be the easiest.

    --
    Regards,
    Tom Ogilvy


    "steve" <[email protected]> wrote in message
    news:[email protected]...
    > i look for the max number in a range of codes in the following format:
    > E06001
    > E06002...
    >
    > here is a section of my code:
    >
    > Set rng = destWB.Worksheets("Sheet1").Range("D5:D" & Lr)
    >
    > rmax = Application.Evaluate("MAX(VALUE(RIGHT(" & _
    > rng.Address(1, 1, xlA1, True) & _
    > ",5)))")
    >
    > ****how can i tell it to ignore blank cells when looking for the max?




  4. #4
    steve
    Guest

    Re: dealing with blank cells in a range

    that works....but i'm confused...what exactly does that do??

    leith....
    if there is a blank cell, i get an error (type mismatch)

    "Tom Ogilvy" wrote:

    > rmax = Application.Evaluate("MAX(VALUE(RIGHT(""00000""&" & _
    > rng.Address(1, 1, xlA1, True) & _
    > ",5)))")
    >
    > Would probably be the easiest.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "steve" <[email protected]> wrote in message
    > news:[email protected]...
    > > i look for the max number in a range of codes in the following format:
    > > E06001
    > > E06002...
    > >
    > > here is a section of my code:
    > >
    > > Set rng = destWB.Worksheets("Sheet1").Range("D5:D" & Lr)
    > >
    > > rmax = Application.Evaluate("MAX(VALUE(RIGHT(" & _
    > > rng.Address(1, 1, xlA1, True) & _
    > > ",5)))")
    > >
    > > ****how can i tell it to ignore blank cells when looking for the max?

    >
    >
    >


  5. #5
    Tom Ogilvy
    Guest

    Re: dealing with blank cells in a range

    During the evaluation, It prepends 5 zeros to the left side the value of
    each cell to guarantee each cell is at least 5 characters - this would
    result in a zero value for blank cells and would not alter any values.

    --
    Regards,
    Tom Ogilvy


    "steve" <[email protected]> wrote in message
    news:[email protected]...
    > that works....but i'm confused...what exactly does that do??
    >
    > leith....
    > if there is a blank cell, i get an error (type mismatch)
    >
    > "Tom Ogilvy" wrote:
    >
    > > rmax = Application.Evaluate("MAX(VALUE(RIGHT(""00000""&" & _
    > > rng.Address(1, 1, xlA1, True) & _
    > > ",5)))")
    > >
    > > Would probably be the easiest.
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > >
    > > "steve" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > i look for the max number in a range of codes in the following format:
    > > > E06001
    > > > E06002...
    > > >
    > > > here is a section of my code:
    > > >
    > > > Set rng = destWB.Worksheets("Sheet1").Range("D5:D" & Lr)
    > > >
    > > > rmax = Application.Evaluate("MAX(VALUE(RIGHT(" & _
    > > > rng.Address(1, 1, xlA1, True) & _
    > > > ",5)))")
    > > >
    > > > ****how can i tell it to ignore blank cells when looking for the max?

    > >
    > >
    > >




+ 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