Giri
05-19-2012, 06:03 AM
Hi Guys,
I am getting a Run-Time Error 9 (Subscript out of Range) when trying to fill an array in the following code.
Dim u As UnitAdjInfo
ReDim unitadj_value(1000)
ReDim fundName(1000)
Dim x As Integer
x = 0
Do
' The LastWord function returns the last word in a string
u.fundName(x) = LastWord(foundCell.Value) ' Run-Time Error 9 Subscript out of Range Error
u.unitadj_value(x) = foundCell.Offset(0, -7).Value
Set foundCell = Range("N2:N" & lastrow_Noms).FindNext(foundCell)
x = x + 1
Loop While Not foundCell Is Nothing And foundCell.Address <> firstfound_Address
In another module, I have the following:
Type UnitAdjInfo
unitadj_value() As Double
fundName() As String
End Type
Anyone know what I am doing wrong here?
Thank you for your help!
Giri
I am getting a Run-Time Error 9 (Subscript out of Range) when trying to fill an array in the following code.
Dim u As UnitAdjInfo
ReDim unitadj_value(1000)
ReDim fundName(1000)
Dim x As Integer
x = 0
Do
' The LastWord function returns the last word in a string
u.fundName(x) = LastWord(foundCell.Value) ' Run-Time Error 9 Subscript out of Range Error
u.unitadj_value(x) = foundCell.Offset(0, -7).Value
Set foundCell = Range("N2:N" & lastrow_Noms).FindNext(foundCell)
x = x + 1
Loop While Not foundCell Is Nothing And foundCell.Address <> firstfound_Address
In another module, I have the following:
Type UnitAdjInfo
unitadj_value() As Double
fundName() As String
End Type
Anyone know what I am doing wrong here?
Thank you for your help!
Giri