Hi at all,
I studied snb's macro. It's a very good job!
I don't understand completly the code but i I proposed to you, an complementary adaptation for 2 columns. It's work fine for me.
Code:
Sub tst()
Feuil1.Cells.UnMerge
M_snb_002 Feuil1.Cells(3, 1)
M_snb_002 Feuil1.Cells(3, 6)
M_snb_002 Feuil1.Cells(3, 11)
M_snb_002 Feuil1.Cells(3, 15)
End Sub
Sub M_snb_002(c00)
sn = c00.CurrentRegion
For j = 1 To UBound(sn)
If sn(j, 1) <> "" Then
For jj = 1 To UBound(sn)
If sn(jj, 2) <> "" Then
If UBound(sn, 2) = 2 Then
c01 = c01 & vbLf & sn(j, 1) & "_" & sn(jj, 2)
Else
For jjj = 1 To UBound(sn)
If sn(jjj, 3) <> "" Then
If UBound(sn, 2) = 3 Then
c01 = c01 & vbLf & sn(j, 1) & "_" & sn(jj, 2) & "_" & sn(jjj, 3)
Else
For jjjj = 1 To UBound(sn)
If sn(jjjj, 4) <> "" Then c01 = c01 & vbLf & sn(j, 1) & "_" & sn(jj, 2) & "_" & sn(jjj, 3) & "_" & sn(jjjj, 4)
Next
End If
End If
Next
End If
End If
Next
End If
Next
sp = Split(Mid(c01, 2), vbLf)
Feuil2.Cells(Rows.Count, 1).End(xlUp).Offset(1).Resize(UBound(sp) + 1) = Application.Transpose(sp)
End Sub
Bookmarks