On a Gantt Chart, I wish to be able to gather from the (PD) Predecessors and (SC) Successors each item that is separated by a comma and pick the (ES) Early Start and (EF) Early Finish, (LS) Late Start and (LF) Late Finish corresponding value to be able to calculate the task (ES) (EF) (LS) (LF) of the next Task. I have found a user defined function that does it but it is referencing to the column A. The function is display below. I have resolved it not using a function but it is very long as it has many (IF) statement and as know, one is limited with the number of (IF). So, I would rather use a user defined function to simplify the calculation.
Now each time I try to insert a column before the Column A All the calculation gets messed up.
Can some one help me change a bit the function so I can insert a column without causing any problem to the calculation.
Thank you in advance!
HTML:
Public Function MultiVLookup(ReferenceIDs As String, Table As Range, TargetColumn As Integer, Optional Delimeter As String = ",") As Variant()
'MultiReference = "A1"
IDs = Split(ReferenceIDs, Delimeter, -1, vbTextCompare)
Length = (UBound(IDs) - LBound(IDs) + 1)
If Length = 0 Then
MultiVLookup = Null
Exit Function
End If
Dim Result() As Variant
ReDim Result(Length - 1)
For i = 0 To Length - 1
Result(i) = Application.WorksheetFunction.VLookup(IDs(i), Table, TargetColumn, False)
Next
MultiVLookup = Result
End Function
Can some one help me change a bit the function so I can insert a column without causing any problem to the calculation.
Thank you in advance!