PC Review


Reply
Thread Tools Rate Thread

copying every other row

 
 
stylaster@gmail.com
Guest
Posts: n/a
 
      14th Jun 2007
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 With Quote
 
 
 
 
=?Utf-8?B?ZHJoYWx0ZXI=?=
Guest
Posts: n/a
 
      14th Jun 2007
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


"(E-Mail Removed)" 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying sheets without copying named ranges NMACK08 Microsoft Excel Programming 1 5th Feb 2008 08:53 PM
Which is faster, copying range to another set of ranges or copying tomemory? axwack Microsoft Excel Programming 2 12th Dec 2007 01:19 PM
copying the Hyperlink function result without copying the actual formula mcheng Microsoft Excel Worksheet Functions 2 9th Jun 2007 02:43 AM
Copying the filtered data to clipboard is copying non-visible rows =?Utf-8?B?U2VldGhhUmFtYW4=?= Microsoft Excel Crashes 10 12th Jul 2006 09:39 PM
Debuggin and Shadow Copying. How to avoid copying dll in temp fold =?Utf-8?B?TWljaGFlbCBOZW10c2V2?= Microsoft C# .NET 4 1st Mar 2006 08:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:57 AM.