Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Help with VBA Type statement

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Help with VBA Type statement

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Help with VBA Type statement

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Help with VBA Type statement

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Help with VBA Type statement

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
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
using error type and if statement to return a value. GAIDEN Excel Worksheet Functions 6 July 25th 08 12:38 AM
Nested If statement to control format of number-type cells TB Excel Worksheet Functions 3 May 16th 08 01:35 AM
IF statement based on data type Reed Excel Worksheet Functions 1 January 20th 05 02:17 PM
Case when statement gives type mismatch Henrik[_6_] Excel Programming 2 June 16th 04 04:36 PM
Type mismatch while running If statement Stel Excel Programming 4 December 18th 03 09:19 AM


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