Hi ,
See the attached file. Run the macro named Sheet2.AssignNames.
Narayan
Hi All,
Can anyone please go through the attached macro in the above thread(if needed , I am attaching again) and try to explain this code. I am unable to get what is this code doing.
I could understand only partially. Line#1,2,3&5 are bit confusing. Not getting the purpose of the index used in each line.
Please explain.
Line1: Set firstcel = IIf(Array_of_Ranges(Match1 + Match2 - 1) Is Nothing, [AssignmentMatrix].Columns(Match1 + Match2).Cells(1, 1), Array_of_Ranges(Match1 + Match2 - 1))
Line 2: Set nextcel = [AssignmentMatrix].Columns(Match1 + Match2).Find("Y", firstcel, , xlWhole, xlByRows, xlNext)
Line 3: assignment = Application.WorksheetFunction.Index([NamesToAssign], nextcel.Row - [NamesToAssign].Cells(1, 1).Row + 1)
Line 4: cel.Value = assignment
Line 5: Set Array_of_Ranges(Match1 + Match2 - 1) = nextcel
Line 6: Set firstcel = nextcel
Thanks,
Sudha