Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Public Sub initialize() Dim NumberOfColumns As Integer NumberOfColumns = 13 Dim p(NumberOfColumns) As Integer end Sub Seems that Excel doesn't like using Variables to intialize arrays. How should this be done? -- zaphod2003 ------------------------------------------------------------------------ zaphod2003's Profile: http://www.excelforum.com/member.php...o&userid=34362 View this thread: http://www.excelforum.com/showthread...hreadid=541455 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
You need Public Sub initialize() Dim NumberOfColumns As Integer Dim p( ) as integer NumberOfColumns = 13 ReDim p(1 to NumberOfColumns) end Sub So you decare the array first with p( ) if you don't yet know the index range. Then you must ReDim it once the index range is known. regards Paul |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
And as the warning message says you can use a Const. Public Sub initialize() Const NumberOfColumns = 13 Dim p(NumberOfColumns) As Integer End Sub Or use the ReDim Public Sub initialize() Dim NumberOfColumns As Integer NumberOfColumns = 13 ReDim p(NumberOfColumns) As Integer End Sub Cheers Andy zaphod2003 wrote: Public Sub initialize() Dim NumberOfColumns As Integer NumberOfColumns = 13 Dim p(NumberOfColumns) As Integer end Sub Seems that Excel doesn't like using Variables to intialize arrays. How should this be done? -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks for your help much appreciated -- zaphod2003 ------------------------------------------------------------------------ zaphod2003's Profile: http://www.excelforum.com/member.php...o&userid=34362 View this thread: http://www.excelforum.com/showthread...hreadid=541455 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Subtraction that doesn't produce an error | Excel Discussion (Misc queries) | |||
new datasource produce no tables | Setting up and Configuration of Excel | |||
Produce the most recent date | Excel Worksheet Functions | |||
produce a formulate to produce assigned seats for dinner | Excel Worksheet Functions | |||
How do I produce a pictogram in Excel | Charts and Charting in Excel |