Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Learning about arrays?

Can anyone recommend a book, website, etc. that provides good, thorough
information on arrays and using them in VBA? I just spent a few days
painfully bludgeoning my way through some code where I learned that I can't
ReDim Preserve the first dimension of a two dimension array, that I had to
declare certain arrays as variant in order to get them to work (with
Transpose, I think), etc. I'd prefer to learn these lessons through other
means ;-)

I did some Google searches but all I could find were tutorials on what an
array is, how to declare them, ReDim/Preserve basics, etc. I am looking for
something more in depth.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Learning about arrays?

Tom,

Thanks for the info. I wasn't expecting an entire book on arrays, though
with all the books out there you just never know.

I don't know that it was the Transpose that caused the issue (and from your
example I suspect it is not). The problem was that I didn't know what I
didn't know. I am using GetPrivateProfile to return some ini keys and
values, removed the NULL values, split the 1D array of key=value into a 2D
array of keys and values, transposed that array, and put it in a range (all
through passing array to multiple function/sub calls). I put it all
together using code I found from Google/Newsgroups with limited
understanding of what I was doing (I tried, but this is the first time I
have dealt with arrays in any real way). I tried so many things and all I
know is that the code would compile but not run unless some of the arrays
were declared as variants (and the only two error messages I got, over and
over and over, were subscript out of range and type mismatch). I probably
declared one array as variant in a function and things propagated from
there. I'd post it but its a lot of code from several modules...I'll go
back and look at some things and try to narrow down the problem area first.

I downloaded Alan Beban's Array Functions and will work through the code and
will continue to ask questions here as needed. This place is better than
any book but learning is a bit disorganized this way, at least for me.
Sorry for the long post and sob story...at least I feel better now ;-)


"Tom Ogilvy" wrote in message
...
Sub ABCD()
Dim v1(1 To 10, 1 To 2) As Long
For i = 1 To 10
For j = 1 To 2
v1(i, j) = i * j
Next
Next
Range("A1:J2") = Application.Transpose(v1)
Dim v2(1 To 10, 1 To 2) As String
For i = 1 To 10
For j = 1 To 2
v2(i, j) = Chr(i + j + 64)
Next
Next
Range("A3:J4") = Application.Transpose(v2)
End Sub

both work and neither involves a variant.

Perhaps you could be more specific on this restriction about Transpose.

You might find a couple of pages in someone's book on Arrays, but it isn't
a
topic large enough by itself. Information on Redim is right in the help
as
is most of what you need to know about arrays.

--
regards,
Tom Ogilvy


"M. Authement" wrote:

Can anyone recommend a book, website, etc. that provides good, thorough
information on arrays and using them in VBA? I just spent a few days
painfully bludgeoning my way through some code where I learned that I
can't
ReDim Preserve the first dimension of a two dimension array, that I had
to
declare certain arrays as variant in order to get them to work (with
Transpose, I think), etc. I'd prefer to learn these lessons through
other
means ;-)

I did some Google searches but all I could find were tutorials on what an
array is, how to declare them, ReDim/Preserve basics, etc. I am looking
for
something more in depth.





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
Working with ranges in arrays... or an introduction to arrays Glen Excel Programming 5 September 10th 06 08:32 AM
Arrays - declaration, adding values to arrays and calculation Maxi[_2_] Excel Programming 1 August 17th 06 04:13 PM
Learning VBA Neal Excel Programming 2 May 25th 06 06:45 PM
Just learning VBA.. Deb Lang Excel Programming 1 October 22nd 03 11:46 PM
Learning VBA Randy Harris Excel Programming 2 September 6th 03 10:59 PM


All times are GMT +1. The time now is 04:49 AM.

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"