[COLOR="Navy"]Sub[/COLOR] MG29Aug59
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, nRng [COLOR="Navy"]As[/COLOR] Range, R [COLOR="Navy"]As[/COLOR] Range, Rr [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] RwMax [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Rw [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Ac [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]With[/COLOR] Sheets("Input Sheet")
[COLOR="Navy"]Set[/COLOR] Rng = .Range(.Range("E2"), .Range("E" & Rows.Count).End(xlUp))
[COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
[COLOR="Navy"]If[/COLOR] Not Dn.Value = "Variant" [COLOR="Navy"]Then[/COLOR]
[COLOR="Navy"]If[/COLOR] nRng [COLOR="Navy"]Is[/COLOR] Nothing [COLOR="Navy"]Then[/COLOR] [COLOR="Navy"]Set[/COLOR] nRng = Dn Else [COLOR="Navy"]Set[/COLOR] nRng = Union(nRng, Dn)
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] Dn
Rw = 1
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Rr [COLOR="Navy"]In[/COLOR] nRng.Areas
RwMax = Application.Max(Rr.Offset(, 1).Value) + 1
ReDim Ray(1 To RwMax, 1 To Rr.Count)
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] R [COLOR="Navy"]In[/COLOR] Rr
[COLOR="Navy"]If[/COLOR] R.Offset(, 1) <> "" [COLOR="Navy"]Then[/COLOR]
Ac = Ac + 1
Ray(1, Ac) = R.Value
[COLOR="Navy"]For[/COLOR] n = 1 To R.Offset(, 1).Value
Ray(n + 1, Ac) = n
[COLOR="Navy"]Next[/COLOR] n
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] R
[COLOR="Navy"]With[/COLOR] Sheets("Output Sheet").Range("c7").Offset(Rw).Resize(RwMax, Ac)
.Value = Ray
[COLOR="Navy"]End[/COLOR] With
Rw = Rw + RwMax + 5
Ac = 0
[COLOR="Navy"]Next[/COLOR] Rr
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]