Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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" wrote in message
...
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?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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" wrote in message
...
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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default dealing with blank cells in a range


Hello Steve,

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

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=504612



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dealing with blank cells Victoria Excel Worksheet Functions 4 November 30th 09 02:39 AM
Range naming cells with blank cells through coding Naveen J V Excel Discussion (Misc queries) 1 March 27th 08 01:46 PM
Maximum Number of Blank Cells between Non Blank Cells in a Range Mal Excel Worksheet Functions 5 November 3rd 07 08:21 AM
Dealing with range of numbers in a cell Penny Excel Worksheet Functions 5 May 4th 06 08:20 PM
How do I skip blank cells when copying over a range of cells? tawells Excel Discussion (Misc queries) 2 June 7th 05 09:36 PM


All times are GMT +1. The time now is 08:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"