ad 1. Green, Bullen, Bovey, Alexander Excel 2007 VBA; Programmer's Reference ISBN 978-0-470-04643-2
ad 2 & ad 3
ad 4. No need to adapt for larger datasets as long as no empty row/column makes part of it.Code:Sub M_snb() sn = Cells(1).CurrentRegion sp = Cells(1).CurrentRegion.Resize(, 10) c00 = 1 For j = 2 To UBound(sn) if(lcase(sn(j,1))="accrue" then c00 = c00 & Replace(String(17, "|"), "|", "|" & j) Next sq = Application.Index(sp, Application.Transpose(Split(c00, "|")), [transpose(row(1:10))]) For j = 2 To UBound(sq) sq(j, 9) = "Brand " & (j - 2) Mod (17) + 1 sq(j, 10) = sn((j + 15) \ 17 + 1, 8 + (j - 2) Mod (17) + 1) Next Cells(40, 1).Resize(UBound(sq), UBound(sq, 2)) = sq End Sub.




Reply With Quote
Bookmarks