Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Get the max number from a collection

Hi Fellows

How can I get the Max number from a collection thata has only numbers

Thanks
GC

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Get the max number from a collection

I think you will just have to loop through all the items.

RBS

wrote in message
ups.com...
Hi Fellows

How can I get the Max number from a collection thata has only numbers

Thanks
GC


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Get the max number from a collection

Sub getmax()
MsgBox Application.Max(Columns("d"))
End Sub
--
Don Guillett
SalesAid Software

wrote in message
ups.com...
Hi Fellows

How can I get the Max number from a collection thata has only numbers

Thanks
GC



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Get the max number from a collection

Hi Don,

What relationship has Columns("d") with the OP's collection?



---
Regards,
Norman



"Don Guillett" wrote in message
...
Sub getmax()
MsgBox Application.Max(Columns("d"))
End Sub
--
Don Guillett
SalesAid Software

wrote in message
ups.com...
Hi Fellows

How can I get the Max number from a collection thata has only numbers

Thanks
GC





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Get the max number from a collection


Ok thanks, If I loop thru the collection how can I get the max?

On Nov 7, 5:02 pm, "Norman Jones"
wrote:
Hi Don,

What relationship has Columns("d") with the OP's collection?

---
Regards,
Norman

"Don Guillett" wrote in l...



Sub getmax()
MsgBox Application.Max(Columns("d"))
End Sub
--
Don Guillett
SalesAid Software

wrote in message
oups.com...
Hi Fellows


How can I get the Max number from a collection thata has only numbers


Thanks
GC- Hide quoted text -- Show quoted text -




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Get the max number from a collection

One approach:

Sub EFG()
Dim col As Collection
Dim i As Long, ii As Long
Dim lmax As Long
Dim itm As Variant
Set col = New Collection
For i = 1 To 30
ii = Int(Rnd() * 100 + 1)
On Error Resume Next
col.Add ii, CStr(ii)
On Error GoTo 0
Next
For Each itm In col
If itm lmax Then
lmax = itm
End If
Next
MsgBox "Max value is: " & lmax
End Sub

--
Regards,
Tom Ogilvy


wrote in message
oups.com...

Ok thanks, If I loop thru the collection how can I get the max?

On Nov 7, 5:02 pm, "Norman Jones"
wrote:
Hi Don,

What relationship has Columns("d") with the OP's collection?

---
Regards,
Norman

"Don Guillett" wrote in
l...



Sub getmax()
MsgBox Application.Max(Columns("d"))
End Sub
--
Don Guillett
SalesAid Software

wrote in message
oups.com...
Hi Fellows


How can I get the Max number from a collection thata has only numbers


Thanks
GC- Hide quoted text -- Show quoted text -




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Get the max number from a collection

I find this way to do it

iva=col(1)

For i = 1 To col.Count
On Error GoTo Fin
If ival col(i + 1) Then
ival = col(i + 1)
End If
Next i

wrote:
Hi Fellows

How can I get the Max number from a collection thata has only numbers

Thanks
GC


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
template for dvd collection David Excel Discussion (Misc queries) 2 April 26th 10 11:35 PM
maximum number of members in a collection excel_ez Excel Programming 8 July 30th 06 10:22 PM
Collection Key gabch[_8_] Excel Programming 4 March 20th 06 04:40 PM
Collection Todd Huttenstine Excel Programming 4 December 17th 04 09:41 PM
cell number in collection Chris Gorham[_3_] Excel Programming 1 December 26th 03 10:47 PM


All times are GMT +1. The time now is 03:08 AM.

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"