#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Moving Rows

How can I move alternate rows in an Excel table up one and over one?

For example I want:

a
b
c
d
e
f

to become:

ab
cd
ef

Thanks.

Ken
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Moving Rows

assume a is in A1

in B1 put in

=if(mod(row(),2)=1,A2,na())
then drag fill down the column

Now select the column, and do Edit=Copy, then immediately do Edit=Paste
Special and select Values

The (column still selected) do Edit=Goto=Special and select constants and
(uncheck all but errors) errors, then do delete and select entirerow.

--
Regards,
Tom Ogilvy

"Ken" wrote in message
om...
How can I move alternate rows in an Excel table up one and over one?

For example I want:

a
b
c
d
e
f

to become:

ab
cd
ef

Thanks.

Ken



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Moving Rows

colNum = 1
a = 1
Do
x = x + 1
Loop Until Cells(x + 1, colNum).Value = ""
y = (x / 2) + 1
For z = y To x
Worksheets(1).Cells(z, colNum).Copy
Worksheets(1).Cells(a, colNum + 1).Insert
Worksheets(1).Cells(z, colNum).Value = ""
a = a + 1
Next z

That should work fine. - Pikus


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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Moving Rows

that takes the lower half of the list and puts it in the next column.

That isn't what was asked for.

--
Regards,
Tom Ogilvy

"pikus" wrote in message
...
colNum = 1
a = 1
Do
x = x + 1
Loop Until Cells(x + 1, colNum).Value = ""
y = (x / 2) + 1
For z = y To x
Worksheets(1).Cells(z, colNum).Copy
Worksheets(1).Cells(a, colNum + 1).Insert
Worksheets(1).Cells(z, colNum).Value = ""
a = a + 1
Next z

That should work fine. - Pikus


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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Moving Rows

You're right. He

colNum = 1
a = 1

Do
x = x + 1
Loop Until Cells(x + 1, colNum).Value = ""

For z = a To x
If z Mod 2 = 0 Then
Worksheets(1).Cells(z, colNum).Copy
Worksheets(1).Cells(z - 1, colNum + 1).Insert
End If
Next z

For z = a To x
If Worksheets(1).Cells(z, colNum + 1).Value = "" Then
Worksheets(1).Rows(z).Delete
End If
Next z

Thanks for the clarification, Yo! - Pikus


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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving Rows teo410 Excel Discussion (Misc queries) 3 August 11th 09 03:21 PM
Moving data from multiple rows to single rows Pete Excel Worksheet Functions 5 February 16th 08 01:51 PM
Moving rows David Excel Discussion (Misc queries) 2 June 26th 05 12:14 AM
Moving columns into rows jim314 Excel Discussion (Misc queries) 1 March 30th 05 10:24 PM
moving rows cdshon Excel Discussion (Misc queries) 3 January 4th 05 09:08 PM


All times are GMT +1. The time now is 01:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"