Redimming arrays in VBA

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-03-06T05:23:53Z Indexed on 2011/03/12 8:10 UTC
Read the original article Hit count: 284

Filed under:
|
|
|

I have 3 arrays of data, that are filled by reading off of an excel sheet, some of the points of data are missing and as such have just been entered into excel as "NA" so I want to look through my array and find each instance of these NA's and remove them from the array since the information is useless. I need to update all three arrays at the same time.

Sub group_data()
    Dim country(), roe(), iCap() As String
    Dim i As Integer
    For i = 1 To 3357
        country(i) = Workbooks("restcompfirm.xls").Worksheets("Sheet1").Range("C1").Offset(i, 0)
        roe(i) = Workbooks("restcompfirm.xls").Worksheets("Sheet1").Range("AP1").Offset(i, 0)
        iCap(i) = Workbooks("restcompfirm.xls").Worksheets("Sheet1").Range("BM1").Offset(i, 0)
    Next i 
End Sub

So if I find a "NA" as one of the values in roe or iCap I want to get rid of that piece of data in all there arrays.

© Stack Overflow or respective owner

Related posts about arrays

Related posts about excel