Grouping the data based on the values of 1 column and then printing it in row format in Excel using macro -
i have data in format
1 45 1 34 1 35 1 36 1 37 1 38 1 23 2 24 2 25 2 26 2 27 3 28 3 29
and want output
1 45 34 35 36 37 38 23 2 24 25 26 27 3 28 29
i have tried using macro unable do. kindly , solve macro.
starting this:
running macro:
sub datareorganizer() dim n long, k long, l long, long n = cells(rows.count, "a").end(xlup).row k = 1 l = 4 cells(k, l).value = cells(1, 1).value cells(k, l + 1).value = cells(1, 2).value l = l + 2 = 2 n if cells(i, 1) = cells(i - 1, 1) cells(k, l) = cells(i, 2) l = l + 1 else l = 4 k = k + 1 cells(k, l) = cells(i, 1) cells(k, l + 1) = cells(i, 2) l = l + 2 end if next end sub
produces this:
Comments
Post a Comment