LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Reading values into an array of User Defined Types

Hi,

I'm new to macro programming.
I need a simple way to sum values in one column based on criteria in
another column eg number of items per country.

Im trying to program this with a array where each element points to a
User Defined Type (containing a string and double value) . I realize I
will need an outer loop to iterate through the entire column and an
inner loop to iterate through the array and add to value of same
country eg. every time I get to a row of France, I have to search for
France in my array and add to the exisiting item value or create a new
array entry for France.

Im getting tangled up in my code and have a feeling I'm doing this the
long way.
Would greatly appereciate some help:

Private Type Volumes
Country As String
Values As Double
End Type
Sub ComputeValues()

Dim rngToSearch As Range
Dim rngFound As Range
Dim mVolumes() As Volumes

Set rngToSearch = Sheets("Bill").Columns("B")
Set rngFound = rngToSearch.Find("Country")

If rngFound Is Nothing Then
MsgBox "No Range found"
Else
rngFound.Select

Set rng = Range(ActiveCell, ActiveCell.End(xlDown))

For Each cell In rng

'This is where I'm stuck

Next

End If

End Sub

Thanks alot in advance!
 
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
User Defined Types and Overloaded Operators eq Excel Programming 4 November 22nd 07 07:40 PM
Checking user defined types for Nothing jayklmno Excel Programming 5 May 3rd 06 09:21 PM
subs or functions with user defined types Ray Pixley Excel Programming 2 February 27th 06 03:25 AM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM


All times are GMT +1. The time now is 08:57 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"