Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Initialize an array

Is there a way to initialize an array the same way you can initialize a
Variant? If so, what is the syntax? I tried to dim an array and make it
equal to an array as below, but could not get it to work. Thanks.

Dim DescArray As Variant, TrackColArray As Variant, ReportColArray As Variant


DescArray = Array("Type", "Store", "Name", "FDO", "GO Weekend", "SS
Groom", _
"Grooming", "DDC", "Phone")
TrackColArray = Array(1, 3, 4, 5, 6, 7, 8, 9, 12)
ReportColArray = Array(1, 2, 4, 5, 6, 7, 8, 9, 10)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Initialize an array

Kleev wrote:
Is there a way to initialize an array the same way you can initialize a
Variant? If so, what is the syntax? I tried to dim an array and make it
equal to an array as below, but could not get it to work. Thanks.

Dim DescArray As Variant, TrackColArray As Variant, ReportColArray As Variant


DescArray = Array("Type", "Store", "Name", "FDO", "GO Weekend", "SS
Groom", _
"Grooming", "DDC", "Phone")
TrackColArray = Array(1, 3, 4, 5, 6, 7, 8, 9, 12)
ReportColArray = Array(1, 2, 4, 5, 6, 7, 8, 9, 10)

What do you mean "could not get it to work." What happens? It works
fine if you break your lines at the right point with appropriate
continuation characters. E.g.,

DescArray = Array("Type", "Store", "Name", "FDO", "GO Weekend", _
"SS Groom", "Grooming", "DDC", "Phone")
TrackColArray = Array(1, 3, 4, 5, 6, 7, 8, 9, 12)
ReportColArray = Array(1, 2, 4, 5, 6, 7, 8, 9, 10)

Alan Beban
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Initialize an array

Sorry. Yes this works fine. What I mean is change the dim statements to
refer to arrays not variants. ie
dim descarray(9)
and then try the following. I cannot get it to work.

Sorry about the original phrasing. Once I posted it, I realized it was open
to interpretation.

"Alan Beban" wrote:

Kleev wrote:
Is there a way to initialize an array the same way you can initialize a
Variant? If so, what is the syntax? I tried to dim an array and make it
equal to an array as below, but could not get it to work. Thanks.

Dim DescArray As Variant, TrackColArray As Variant, ReportColArray As Variant


DescArray = Array("Type", "Store", "Name", "FDO", "GO Weekend", "SS
Groom", _
"Grooming", "DDC", "Phone")
TrackColArray = Array(1, 3, 4, 5, 6, 7, 8, 9, 12)
ReportColArray = Array(1, 2, 4, 5, 6, 7, 8, 9, 10)

What do you mean "could not get it to work." What happens? It works
fine if you break your lines at the right point with appropriate
continuation characters. E.g.,

DescArray = Array("Type", "Store", "Name", "FDO", "GO Weekend", _
"SS Groom", "Grooming", "DDC", "Phone")
TrackColArray = Array(1, 3, 4, 5, 6, 7, 8, 9, 12)
ReportColArray = Array(1, 2, 4, 5, 6, 7, 8, 9, 10)

Alan Beban

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Initialize an array

Dim descarray()
ReDim descarray(9)

Alan Beban

Kleev wrote:
Sorry. Yes this works fine. What I mean is change the dim statements to
refer to arrays not variants. ie
dim descarray(9)
and then try the following. I cannot get it to work.

Sorry about the original phrasing. Once I posted it, I realized it was open
to interpretation.

"Alan Beban" wrote:


Kleev wrote:

Is there a way to initialize an array the same way you can initialize a
Variant? If so, what is the syntax? I tried to dim an array and make it
equal to an array as below, but could not get it to work. Thanks.

Dim DescArray As Variant, TrackColArray As Variant, ReportColArray As Variant


DescArray = Array("Type", "Store", "Name", "FDO", "GO Weekend", "SS
Groom", _
"Grooming", "DDC", "Phone")
TrackColArray = Array(1, 3, 4, 5, 6, 7, 8, 9, 12)
ReportColArray = Array(1, 2, 4, 5, 6, 7, 8, 9, 10)


What do you mean "could not get it to work." What happens? It works
fine if you break your lines at the right point with appropriate
continuation characters. E.g.,

DescArray = Array("Type", "Store", "Name", "FDO", "GO Weekend", _
"SS Groom", "Grooming", "DDC", "Phone")
TrackColArray = Array(1, 3, 4, 5, 6, 7, 8, 9, 12)
ReportColArray = Array(1, 2, 4, 5, 6, 7, 8, 9, 10)

Alan Beban

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Initialize an array

That did work and I thank you for the answer. I, however, made another
mistake. As soon as I posted my last reply, I realized that the way I had
dimmed descarray was not quite complete. I should have written dim
descarray(9) as string.

Since I cannot get it to work other than as a Variant, I will just use that.
It was just that I had heard so much about using Variants only when
absolutely necessary, I would try to dimension the array as the correct type.

Thanks.

"Alan Beban" wrote:

Dim descarray()
ReDim descarray(9)

Alan Beban

Kleev wrote:
Sorry. Yes this works fine. What I mean is change the dim statements to
refer to arrays not variants. ie
dim descarray(9)
and then try the following. I cannot get it to work.

Sorry about the original phrasing. Once I posted it, I realized it was open
to interpretation.

"Alan Beban" wrote:


Kleev wrote:

Is there a way to initialize an array the same way you can initialize a
Variant? If so, what is the syntax? I tried to dim an array and make it
equal to an array as below, but could not get it to work. Thanks.

Dim DescArray As Variant, TrackColArray As Variant, ReportColArray As Variant


DescArray = Array("Type", "Store", "Name", "FDO", "GO Weekend", "SS
Groom", _
"Grooming", "DDC", "Phone")
TrackColArray = Array(1, 3, 4, 5, 6, 7, 8, 9, 12)
ReportColArray = Array(1, 2, 4, 5, 6, 7, 8, 9, 10)

What do you mean "could not get it to work." What happens? It works
fine if you break your lines at the right point with appropriate
continuation characters. E.g.,

DescArray = Array("Type", "Store", "Name", "FDO", "GO Weekend", _
"SS Groom", "Grooming", "DDC", "Phone")
TrackColArray = Array(1, 3, 4, 5, 6, 7, 8, 9, 12)
ReportColArray = Array(1, 2, 4, 5, 6, 7, 8, 9, 10)

Alan Beban




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Initialize an array

If the functions in the freely downloadable file at
http://home.pacbell.net/beban are available to your workbook

Dim DescArray() As String
ReDim DescArray(9)
Assign Array("Type", "Store", "Name", "FDO", "GO Weekend", _
"SS Groom", "Grooming", "DDC", "Phone"), DescArray

Alan Beban

Kleev wrote:
That did work and I thank you for the answer. I, however, made another
mistake. As soon as I posted my last reply, I realized that the way I had
dimmed descarray was not quite complete. I should have written dim
descarray(9) as string.

Since I cannot get it to work other than as a Variant, I will just use that.
It was just that I had heard so much about using Variants only when
absolutely necessary, I would try to dimension the array as the correct type.

Thanks.

"Alan Beban" wrote:


Dim descarray()
ReDim descarray(9)

Alan Beban

Kleev wrote:

Sorry. Yes this works fine. What I mean is change the dim statements to
refer to arrays not variants. ie
dim descarray(9)
and then try the following. I cannot get it to work.

Sorry about the original phrasing. Once I posted it, I realized it was open
to interpretation.

"Alan Beban" wrote:



Kleev wrote:


Is there a way to initialize an array the same way you can initialize a
Variant? If so, what is the syntax? I tried to dim an array and make it
equal to an array as below, but could not get it to work. Thanks.

Dim DescArray As Variant, TrackColArray As Variant, ReportColArray As Variant


DescArray = Array("Type", "Store", "Name", "FDO", "GO Weekend", "SS
Groom", _
"Grooming", "DDC", "Phone")
TrackColArray = Array(1, 3, 4, 5, 6, 7, 8, 9, 12)
ReportColArray = Array(1, 2, 4, 5, 6, 7, 8, 9, 10)

What do you mean "could not get it to work." What happens? It works
fine if you break your lines at the right point with appropriate
continuation characters. E.g.,

DescArray = Array("Type", "Store", "Name", "FDO", "GO Weekend", _
"SS Groom", "Grooming", "DDC", "Phone")
TrackColArray = Array(1, 3, 4, 5, 6, 7, 8, 9, 12)
ReportColArray = Array(1, 2, 4, 5, 6, 7, 8, 9, 10)

Alan Beban


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
initialize userform, using a sub natanz[_2_] Excel Programming 11 November 22nd 05 05:30 AM
Initialize macro Tom Jung Excel Programming 1 October 31st 05 04:04 AM
Initialize variable hotherps[_128_] Excel Programming 2 August 26th 04 02:38 PM
need form to initialize without closing bruce forster Excel Programming 2 April 21st 04 11:57 PM
Initialize data in new row? Ken[_12_] Excel Programming 1 August 9th 03 05:13 PM


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