P
PBcorn
I am using the split function to return the arguments in sum functions, of
which there are many in each worksheet. Eg a cell with =sum(a1,a2,a3,a4), I
need to return a1 to a4 then read these into a dynamic array. Split function
returns a 1-d array but i can't work out how to read into inparray(). Help
appreciated. Thanks
Dim c As Range
Dim sht As Worksheet
Dim inparray() As String
Dim sformula As String
Dim i As Integer
Dim l As Integer
For Each sht In ActiveWorkbook.Worksheets
For Each c In sht.UsedRange.Cells
If c.HasFormula = True Then
l = Len(c.Formula) - 6
sformula = Mid(c.Formula, 6, l)
ReDim inparray(UBound(Split(sformula, ",", -1))) As String
inparray() = Split(sformula, ",", -1)
Else: End If
Next c
Next sht
End Sub
which there are many in each worksheet. Eg a cell with =sum(a1,a2,a3,a4), I
need to return a1 to a4 then read these into a dynamic array. Split function
returns a 1-d array but i can't work out how to read into inparray(). Help
appreciated. Thanks
Dim c As Range
Dim sht As Worksheet
Dim inparray() As String
Dim sformula As String
Dim i As Integer
Dim l As Integer
For Each sht In ActiveWorkbook.Worksheets
For Each c In sht.UsedRange.Cells
If c.HasFormula = True Then
l = Len(c.Formula) - 6
sformula = Mid(c.Formula, 6, l)
ReDim inparray(UBound(Split(sformula, ",", -1))) As String
inparray() = Split(sformula, ",", -1)
Else: End If
Next c
Next sht
End Sub