View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Private type - please give example

I assume you mean User-defined type:

Type Car
CarModel As String
CarRego As String
CarYearOfMfg As Integer
CarMilage As Double
CarAlarm As Boolean
End Type

Sub Tester1()
Dim mycar As Car
mycar.CarModel = "Ford"
mycar.CarRego = "1234ABC5678"
mycar.CarYearOfMfg = "2002"
mycar.CarMilage = 8350.2
mycar.CarAlarm = True
End Sub

Once the values are populated, you can retrieve their values using the same
construct (observing lifetime and scoping rules).

msgbox mycar.CarMilage

--
Regards,
Tom Ogilvy

"count" wrote in message
...
Hi,
Can you provide an example (if possible) of usage of Private Type of the
following structu

CarModel as String
CarRego as String
CarYearOfMfg as Integer
CarMilage as Double
CarAlarm As Boolean

In particular, I need to get a grasp how using of Private Type can help
populating UserForm and then sheet cells. Will it be possible with them to
eliminate the need for named ranges? Or the opposite is true?

Hope it's easy to answer :)

Paul