Moving data from one place to another

K

Karen Sigel

I have a spreadsheet with several thousand rows. I made every other row blank
using a macro I found here (thanks!). Now, I need to move the data that
resides in Row 1 L, M, N, O (a populated row) to Row 2 C, D, E, F (the blank
row I inserted) for the whole sheet.

Is this possible? Can someone help me out?

Thanks-
Karen
 
J

Joel

Sub MoveData()
RowCount = 1
Do While Range("A" & RowCount) <> ""
Range("L" & RowCount & ":O" & RowCount).Cut _
Destination:=Range("C" & (RowCount + 1))
RowCount = RowCount + 2
Loop

End Sub
 
G

Gary''s Student

Sub Macro1()
For i = 1 To 100 Step 2
Range("L" & i & ":O" & i).Select
Selection.Cut
Range("C" & i + 1).Select
ActiveSheet.Paste
Next
End Sub

Adjust the 100 (table size) to suit your needs.
 
K

Karen Sigel

Well, either I'm completely misunderstanding both of your replies (which is a
distinct possibility!) or I didn't explain myself well enough.

I need to move the data in Row 1 cells L, M, N, O to Row 2 cells C, D, E, F,
then the data in Row 3, cells L, M, N, O to Row 4, cells C, D, E, F, then the
next two rows, then the next, etc., until I reach the end.

I already figured out that i have to temporarily delete my header row, but
is there anything else I need to do to make this work correctly?

Karen
 
G

Gary''s Student

Both Joel's macro and my macro will do want you want. Perhaps we should have
explained how they are used:


Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top