Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using Excel 2000, and I am attempting to build, what I consider an array
using the Type declariation. Public Type SIGDB SigName As String * 12 SigType As String * 15 Conflict As Integer Oppos As Integer Para As Integer OS As Integer AspectIndexClr As Integer AspectIndexStop As Integer AspectClrName As String * 20 AspectStopName As String * 15 AppBlk As String * 8 Side As String * 2 Direction As String * 2 End Type In a module I have: For i = 1 To NumSig ReDim Route(i) As SIGDB Route(i).SigName = Cells(cRow, 1) Route(i).SigType = Cells(cRow, 2) next i When I later attempt to access the data it's not there. Any ideas? Bob |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The Redim statement will clear the contents of the array. Use the
Preserve keyword to preserve the contents of the array. E.g., ReDim Preserve Route(i) As SIGDB -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Rednosebob" wrote in message ... I am using Excel 2000, and I am attempting to build, what I consider an array using the Type declariation. Public Type SIGDB SigName As String * 12 SigType As String * 15 Conflict As Integer Oppos As Integer Para As Integer OS As Integer AspectIndexClr As Integer AspectIndexStop As Integer AspectClrName As String * 20 AspectStopName As String * 15 AppBlk As String * 8 Side As String * 2 Direction As String * 2 End Type In a module I have: For i = 1 To NumSig ReDim Route(i) As SIGDB Route(i).SigName = Cells(cRow, 1) Route(i).SigType = Cells(cRow, 2) next i When I later attempt to access the data it's not there. Any ideas? Bob |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I get a compiler error: Variable not defined.
"Rednosebob" wrote: I am using Excel 2000, and I am attempting to build, what I consider an array using the Type declariation. Public Type SIGDB SigName As String * 12 SigType As String * 15 Conflict As Integer Oppos As Integer Para As Integer OS As Integer AspectIndexClr As Integer AspectIndexStop As Integer AspectClrName As String * 20 AspectStopName As String * 15 AppBlk As String * 8 Side As String * 2 Direction As String * 2 End Type In a module I have: For i = 1 To NumSig ReDim Route(i) As SIGDB Route(i).SigName = Cells(cRow, 1) Route(i).SigType = Cells(cRow, 2) next i When I later attempt to access the data it's not there. Any ideas? Bob |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What line of code gives you the error? Have you actually declared
the variable? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Rednosebob" wrote in message ... I get a compiler error: Variable not defined. "Rednosebob" wrote: I am using Excel 2000, and I am attempting to build, what I consider an array using the Type declariation. Public Type SIGDB SigName As String * 12 SigType As String * 15 Conflict As Integer Oppos As Integer Para As Integer OS As Integer AspectIndexClr As Integer AspectIndexStop As Integer AspectClrName As String * 20 AspectStopName As String * 15 AppBlk As String * 8 Side As String * 2 Direction As String * 2 End Type In a module I have: For i = 1 To NumSig ReDim Route(i) As SIGDB Route(i).SigName = Cells(cRow, 1) Route(i).SigType = Cells(cRow, 2) next i When I later attempt to access the data it's not there. Any ideas? Bob |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The "Public Type SIGDB" is defined in Declariations section of the program
and the compiler errors occurs in the Module code where I'm using the "ReDim Preserve Route(i) As SIGDB". Thanks! Bob "Chip Pearson" wrote: What line of code gives you the error? Have you actually declared the variable? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Rednosebob" wrote in message ... I get a compiler error: Variable not defined. "Rednosebob" wrote: I am using Excel 2000, and I am attempting to build, what I consider an array using the Type declariation. Public Type SIGDB SigName As String * 12 SigType As String * 15 Conflict As Integer Oppos As Integer Para As Integer OS As Integer AspectIndexClr As Integer AspectIndexStop As Integer AspectClrName As String * 20 AspectStopName As String * 15 AppBlk As String * 8 Side As String * 2 Direction As String * 2 End Type In a module I have: For i = 1 To NumSig ReDim Route(i) As SIGDB Route(i).SigName = Cells(cRow, 1) Route(i).SigType = Cells(cRow, 2) next i When I later attempt to access the data it's not there. Any ideas? Bob |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
using error type and if statement to return a value. | Excel Worksheet Functions | |||
Nested If statement to control format of number-type cells | Excel Worksheet Functions | |||
IF statement based on data type | Excel Worksheet Functions | |||
Case when statement gives type mismatch | Excel Programming | |||
Type mismatch while running If statement | Excel Programming |