Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copying every other row

Hi All
I have data in column A1 to A2564. I want to take every other line
ie(A1, A3, A5, etc) and copy that to match the even columns in column
B. ie (A2 would go into B1, A4 would go into B3, etc.
So it is taking the value in every other line and copying it and
moving it up one cell and over one cell.
Thanks!
Roy

Example
A1 1
A2 2
A3 3
A4 4

Result
Al 1 B1 2
A2 now blank
A3 3 B3 3
A4 blank now

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default copying every other row

Sounds like a lot of work to do each one with the mouse! If I understand
correctly you want to move data from A2 to B1, A4 to B3, and etc.. You do
not want to leave data in A2, A4, A6, etc. I have this code setting A2, A4,
A6 etc to Empty, which effectively deletes the content in those cells.

try this: in a module of VB...

Private Sub moveitems()

Dim n As Integer
n = 1
Do Until n 2654
Cells(n, 2) = Cells(n + 1, 1) 'move the data
Cells(n + 1, 1) = Empty 'delete the original data
n = n + 2 'increase the counter by two to
get every other line
Loop


End Sub


" wrote:

Hi All
I have data in column A1 to A2564. I want to take every other line
ie(A1, A3, A5, etc) and copy that to match the even columns in column
B. ie (A2 would go into B1, A4 would go into B3, etc.
So it is taking the value in every other line and copying it and
moving it up one cell and over one cell.
Thanks!
Roy

Example
A1 1
A2 2
A3 3
A4 4

Result
Al 1 B1 2
A2 now blank
A3 3 B3 3
A4 blank now


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
Copying everything KRK New Users to Excel 4 November 18th 09 11:35 PM
copying the Hyperlink function result without copying the actual formula mcheng Excel Worksheet Functions 2 June 9th 07 02:43 AM
copying Curt Excel Programming 2 March 16th 07 07:13 PM
TextBox copying not like windows copying, heh? Antoine Excel Programming 3 August 16th 05 03:35 PM
Copying data down to next dirty cell, then copying that data slarson Excel Programming 0 September 15th 03 09:19 PM


All times are GMT +1. The time now is 02:45 PM.

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"