how do I rearrange a column into a series of columns?
R Morahn,
This is Visual Basic code. You don't paste it into the worksheet. You need
to open the Visual Basic Editor (VBE), by pressing Alt-F11, insert a module
and paste the code into that. You can then add a button from the Forms
toolbar and assign this macro to it. Or you can run it from inside the VBE
by putting your cursor somewhere inside the macro and pressing F5.
If you are planning on doing more than this, you probably need to read up on
VBA and the VBE.
hth,
Doug
"RMorahn" wrote in message
...
"Doug Glancy" wrote:
R Morahn,
This took me forever to figure out! I think it works though. Assuming
your
data is in column A, this puts the results in column B through H:
Sub test()
Dim from_cells_count As Long
Dim i As Long
Dim row_num As Long
Dim col_num As Long
from_cells_count = (Range("A" & Rows.Count).End(xlUp).Row)
For i = 1 To from_cells_count
If Int(i / 7) < i / 7 Then
row_num = Int(i / 7) + 1
col_num = (i Mod 7) + 1
Else
row_num = i / 7
col_num = 8
End If
Cells(row_num, col_num) = Range("A" & i)
Next i
End Sub
hth,
Doug
doug--
i don't know how to paste the routine. when I copy and paste, each line
goes
into a different row, and so it doesn't execute. Do i have to do anyhting
to
the cell where I'm pasting the routine?
Thanks,
Rich
"RMorahn" wrote in message
...
some one sent ma large file with seven recurring fields all in one
single
column. Is there some macro that will move each of seven rows to a
separate
column and then restart the process with each seventh line to the end
of
the
file. There are too many items to do this manually? Each field item
recurs
every seven lines.
|