Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default rediming dynamic 2 dimensional array of user defined type

I defined a dynamic array as a programmer defined type that contains a
dynamic array of type Date as below:

Public Type Material
MatNum As Integer
MatDate() As Date
End Type

Public matType() As Material

when I go to redim them as such:

' no problem here
ReDim matType(1 To MaxMaterials)
' error invalid qualifier "matType." if I leave it out, does not create
an array
ReDim matType.MatDate(1 To MaxArraySize)

any ideas how to redim the MatDate?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default rediming dynamic 2 dimensional array of user defined type

Maybe you want something like:

Option Explicit
Public Type Material
MatNum As Integer
MatDate() As Date
End Type
Public matType() As Material
Sub testme()
Dim MaxMaterials As Long
Dim MaxArraySize As Long
Dim ictr As Long
MaxMaterials = 3
MaxArraySize = 4
' no problem here
ReDim matType(1 To MaxMaterials)

For ictr = 1 To MaxMaterials
ReDim matType(ictr).MatDate(1 To MaxArraySize)
Next ictr
End Sub

if each mattype has the same number of .matdates.



Arnold Klapheck wrote:

I defined a dynamic array as a programmer defined type that contains a
dynamic array of type Date as below:

Public Type Material
MatNum As Integer
MatDate() As Date
End Type

Public matType() As Material

when I go to redim them as such:

' no problem here
ReDim matType(1 To MaxMaterials)
' error invalid qualifier "matType." if I leave it out, does not create
an array
ReDim matType.MatDate(1 To MaxArraySize)

any ideas how to redim the MatDate?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default rediming dynamic 2 dimensional array of user defined type

Public Type Material
MatNum As Integer
MatDate() As Date
End Type

Public matType() As Material

Const MaxMaterials As Long = 12
Sub ABCEFG()
ReDim matType(1 To MaxMaterials)
For i = 1 To MaxMaterials
ReDim matType(i).MatDate(1 To 10)
Next

End Sub

--
regards,
Tom Ogilvy


"Arnold Klapheck" wrote:

I defined a dynamic array as a programmer defined type that contains a
dynamic array of type Date as below:

Public Type Material
MatNum As Integer
MatDate() As Date
End Type

Public matType() As Material

when I go to redim them as such:

' no problem here
ReDim matType(1 To MaxMaterials)
' error invalid qualifier "matType." if I leave it out, does not create
an array
ReDim matType.MatDate(1 To MaxArraySize)

any ideas how to redim the MatDate?

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
Type Mismatch: array or user defined type expected ExcelMonkey Excel Programming 4 July 6th 06 03:40 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Passing User Defined Type Array to Listbox PC[_4_] Excel Programming 2 June 1st 05 02:44 AM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM
Passing an Array of User-Defined Type to an Argument of a Function Tushar Mehta[_6_] Excel Programming 0 August 17th 03 06:43 PM


All times are GMT +1. The time now is 08:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"