View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default Aplication.Worksheetfunction.MAX() Stopped Working

Might you have text in one of your ranges?
--
HTH,
Barb Reinhardt



"Minitman" wrote:

I forgot to mention, Column C is at this time completely empty.

-Minitman

On Fri, 09 Nov 2007 01:05:17 -0600, Minitman
wrote:

Greetings,

I have an invoice number generator on a UserForm run from a
CommandButton. Here is the code:

Dim rIN1 As Range
Dim rIN2 As Range

ThisWorkbook.Activate
Set rIN1 = Range("rInvNums_1st")
Set rIN2 = Range("rInvNums_List")
Input_1.Value = Application.WorksheetFunction.Max(rIN1, rIN2) + 1

With the named range "rInvNums_1st" equal to 3311000 (The first
possible invoice number minus 1) and the named range "rInvNums_List"
equal to the numbers in column C, (the list of existing invoice
numbers). This should produce the number 3311001 for the first
invoice number, instead it is producing the number 1!

When I check it with debug, debug shows the value of rIN1 as 3311000
and did not show anything for rIN2.

Anyone have any ideas as to what is wrong with this code?

Any help is greatly appreciated.

Thanks.

-Minitman