LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default help with arrays

I post sample code specific to your situation that works. I gave you an
revised example of what you tried.

Perhaps looking at these and asking questions about what you don't
understand. There really isn't a whole lot of mystery to them, so you won't
find pages of information written on them.

--
Regards,
Tom Ogilvy

mike wrote in message
...
Your right. I am new to VBA and am trying to learn as
much as possible. I understand the concept of arrays and
how they can be used but I am having difficulty in how
they are dimensioned. If you can point me to a good
resource or reference, it would be greatly appreciated.


-----Original Message-----
I posted tested code that works based on your

description. Frankly, the
code you show demonstrates you don't seem to have a

concept of how to use
arrays or how they are dimensioned.

given those are your fields


Dim i As Integer
Dim Writeoffs()
Dim FieldNames as Variant
JVCounter = 1
FieldNames = Array("Cust", "DocNo", "DrBr", "CrBr":, _
"DrAcctAmt", "CrAcctAmt", "DrAcctNo", "CrAcctNo", "Descr

")
numElem = Ubound(FieldNames,1) - Lbound(FieldNames,1) + 1
ReDim Writeoffs(1 To i, 1 to NumElem)

Would be the direction you are headed.

Think of the array being identical to the rows and cells

of your speadsheet.
You spreadsheet has two dimensions; so does the array.

Your filed names would not be variables unless you are

going to use
variables that just happen to share the name of the

fields. (but for what
purpose it would be hard to fathom).

--
Regards,
Tom Ogilvy



"mike" wrote in

message
...
I am trying to create an array but am getting a data

type
mismatch error on the ReDim statement. Can anyone tell

me
why?

One other thing that may be important is that I have
declared Cust, DocNo, DrBr, etc as public variables at

the
beginning of the module and assigned different data

types
to the variables depending on the data in the particular
field.

Dim i As Integer
Dim Writeoffs()
JVCounter = 1
ReDim Writeoffs(1 To i, Cust, DocNo, DrBr, CrBr, _
DrAcctAmt, CrAcctAmt, DrAcctNo, CrAcctNo, Descr)

Any help would be greatly appreciated. Thanks.



.





 
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
Arrays David Excel Discussion (Misc queries) 2 May 12th 09 10:16 PM
Arrays Abdul Shakeel Excel Worksheet Functions 1 December 12th 08 10:24 AM
Use of arrays Dave F Excel Worksheet Functions 0 November 30th 06 04:26 PM
arrays solo_razor[_44_] Excel Programming 2 December 15th 03 12:06 PM
Arrays drtaclem Excel Programming 0 December 10th 03 07:55 PM


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