ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Easy Array Question... (https://www.excelbanter.com/excel-programming/307500-re-easy-array-question.html)

RB Smissaert

Easy Array Question...
 
This will work:

Sub test()

Dim arr
Dim iCount As Integer

iCount = 100

ReDim arr(iCount) As Integer

End Sub


RBS

"Jeff Harbin" wrote in message
...
I've got an range of cells of varying size made up of predominately

doubles
with a few strings sprinkled amongst the doubles. I need to sort through

the
array, determine the number of doubles in the array, and then populate an
array with the doubles.

I thought I could loop through the cells count the number of doubles,

store
the number of doubles as a variable (iFinalCount), and then Dim an Array
using the iFinalCount variable like so...

Dim DataArray(1 to iFinalCount) as Double

When I try to run the code I get the following error:

Compile Error
Constant Expression required

If I hit Debug it takes me to the iFinalCount in the Array dimensioning
statement.

Btw...iFinalCount is defined as an integer

Thanks,

Jeff




All times are GMT +1. The time now is 11:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com