View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Nicky[_4_] Nicky[_4_] is offline
external usenet poster
 
Posts: 1
Default help with transpose-like macro

Hi
Try this, entering the address of the range of cells containing your
data to be rearrange as 'input range' anf the furst cell of the range
to transpose to as output_range:


Sub arrange_data()
input_range = Range("a1:d3").Address 'range containing data to
transpose
output_range = Range("a6").Address 'address of first cell for
transposed data
input_cols = Range(input_range).Columns.Count
input_rows = Range(input_range).Rows.Count

off_n = 0


For rn = 1 To input_rows
For cn = 2 To input_cols
txt = Range(input_range).Columns(1).Rows(rn).Value & " " &
Range(input_range).Columns(cn).Rows(rn).Value
Range(output_range).Offset(off_n, 0).Value = txt
off_n = off_n + 1

Next
Next

End Sub


---
Message posted from http://www.ExcelForum.com/