Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
In the following function below, I am trying to select a range of cells containing text, extract the numbers from those text strings, assign each string to an array index, and finally return the array as a range. I haven't used an array in a function before, so I'm sure my error is there. The number-extracting part works fine (the "Digi" loop) as I have used it elsewhere, but I think I am not assigning the strings to the array properly. I appreciate any suggestions! Code: Public Function ExtractFundID(ByVal HoldingNameRange As Range) As Range Dim HoldingName As Range Dim IDOutputList As Range Dim IDOutputArray() As Integer Dim OutputIndex As Integer Dim IDString As String IDString = "" OutputIndex = 0 For Each HoldingName In HoldingNameRange For Digi = 1 To Len(HoldingName) If IsNumeric(Mid(HoldingName, Digi, 1)) Then Chara = Mid(HoldingName, Digi, 1) Else: GoTo Loopy End If IDString = IDString & Chara Loopy: Next Digi IDOutputArray(OutputIndex) = IDString IDString = "" OutputIndex = OutputIndex + 1 Next HoldingName ReDim Preserve IDOutputArray(OutputIndex) ExtractFundID.Name = "FundIDRange" ExtractFundID.Value = IDOutputArray End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Redimming an array dynamically assigned from range (how to redim first dimension of a 2-D array? /or/ reverse the original array order) | Excel Programming | |||
Returning an array from a multi-dimensional array | Excel Programming | |||
Returning Array ... | Excel Programming | |||
Returning array ... | Excel Programming | |||
Returning an array from a UDF to a column range | Excel Programming |