Hi Team
I know array start with zero by default, by declaring option base1 it will start from 1 ,
is it possible to start an array from 2?... plz help new in array
Regards,
Mallesh
Hi Team
I know array start with zero by default, by declaring option base1 it will start from 1 ,
is it possible to start an array from 2?... plz help new in array
Regards,
Mallesh
Dim myArray(2 to 10) Dim SomeVariable As Variant Dim OtherVar(1 to 10, 1 to 10) ReDim SomeVariable(2 to 20) Redim OtherVar(2 to 11, 2 to 11)
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ
You can (as Sam said) start arrays at any start/end
The Option Base is for when you do NOT explicitly specify
So if you can pick your bounds correctly, you can make life easier. You should use LBound and UBound
Example: working with rows 16 to 32
Dim A (16 to 32) as Long For r = LBound(A) to UBound(A) Cells(r,1).Value = 2*Cells(r,2) Next r
or even use enumerations
Dim D(vbSunday to vbSaturday)
If you define your own enumerations, it does help readability
Enum colNames FName =12 LName = 13 Addr = 14 End Enum Dim N(FName to Addr)
---------------------------------------------------------------------------------------------------------------------
Paul
Remember: Tell us WHAT you want to do, not HOW you think you want to do it
1. Use [CODE] ....[/CODE ] Tags for readability
[CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
2. Upload an example
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
3. Mark the thread as [Solved] when you have an answer
Thread Tools (on the top right corner, above the first message)
4. Read the Forum FAQ, especially the part about cross-posting in other forums
http://www.vbaexpress.com/forum/faq...._new_faq_item3