Creating a custom data type


Posted by tanya on June 13, 2001 4:51 AM

How do I create my own custom data type?

For example, I want to create a custom data type called Fruit which consists of a finite number of values like Apple, Banana, Orange etc.

Thanks alot. I really appreciate it.

Posted by Ivan F Moala on June 13, 2001 5:26 AM

Tanya
If I understand you correctly you want the data
type for a Sub or function ??
The something along these lines may help,

In a module;

Type fruit
orange As Integer
banana As Integer
pears As Integer
apples As Integer
End Type

Sub Test()
Dim Fr As fruit

Fr.apples = 12
Fr.pears = 1

MsgBox Fr.apples & ":" & Fr.pears

End Sub

HTH


Ivan



Posted by tanya on June 17, 2001 11:11 PM


Thanks Ivan.

For example, I want to be able to look for cells in a worksheet that contain a value of type Fruit. If a cell is of that type then I want to perform an operation on that cell.

At the moment I'm using a function which looks for text strings that look like "Apple", "Orange"
etc. but it takes a long time because I have to look for each individual match.