Home |
Search |
Today's Posts |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim v as Variant
v = Range("A1:B9").Value v is always 1 based in both dimensions. -- Regards, Tom Ogilvy "NickHK" wrote: Keith, Whilst your example was not correct as to VBA's behaviour and others have pointed out better way of dealing with arrays, you should be aware that there are statements that do ignore the Option base setting. e.g. Option Base 1 Private Sub CommandButton1_Click() Dim carray carray = Split("1,2,3,4", ",") MsgBox carray(1) 'returns a value of 2 End Sub NickHK "Keith" wrote in message ... Using XL 2003. I generally set Option Base 1 in my projects, as a personal preference (MS gave us the option, so I'd think either way is ok). However, even in Option Base 1 project, some arrays don't start with 1, such as: Option Base 1 Sub testme CArray = Array(1,2,3,4) Msgbox CArray(1) 'returns a value of 2 End Sub Is there a way to ensure that these 'on the fly' arrays also start with Base 1, or am I stuck with having mixed array types if I assign these arrays on the fly? Thanks! Keith |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Option Base error... | Excel Programming | |||
Can you Auto fill address in excell with a data base? | Excel Worksheet Functions | |||
Option Commands (Option Explicit / Option Base etc) - Scope | Excel Programming | |||
Knowledge Base 247412 need help to make work | Excel Programming | |||
Option Base and reading from Access | Excel Programming |