0

I have two worksheets, I want to paste columns one after another from sheet1 to columns one after another. My data is like this:

Sheet1:
  A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V 
  12      14      9      20       6       7       21       6      23      12      23
   2       4      5       6       8       9        9       0       7       5      12 
   1      12     14      14      15       6       43      21      65       5      33

Sheet2:
 A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V
  1       2      4        2      23      13       4       6       7      56      45
 12      13     13       12      14      13      34      34      65      75       4
 11      22     33       44      44      23      24      54      32      23      12

I want to paste Column A from sheet1 into sheet2 at Column B, similarly I want to paste Column C in sheet1 to Column D in sheet2, and so on.

I have around 24 such rows and 326 columns in sheet1 & 2 respectively. Kindly guide me about the automatic procedure related to such type of pasting? I am using Excel 2010.

0

2 Answers 2

1

Insert a column on the extreme left of Sheet2 and in a new sheet A1 enter:

=IF(ISODD(COLUMN()),Sheet1!A1,Sheet2!A1)  

copy across and down to suit.

0

This macro does it for you

Sub Button4_Click()

Dim col As Integer
col = 65

Dim preCol As Integer
preCol = 64

Do While (True)    

    If (col > 90) Then
        preCol = preCol + 1
        col = 65
    End If

    If (preCol = 64) Then

        If (Sheets("Sheet1").Range(Chr(col) & "1") = "") Then
            Exit Do
        End If

        Sheets("Sheet1").Columns(Chr(col) & ":" & Chr(col)).Copy Sheets("Sheet2").Range(Chr(col + 1) & "1")

    Else

        If (Sheets("Sheet1").Range(Chr(preCol) & Chr(col) & "1") = "") Then
            Exit Do
        End If

        Sheets("Sheet1").Columns(Chr(preCol) & Chr(col) & ":" & Chr(preCol) & Chr(col)).Copy Sheets("Sheet2").Range(Chr(preCol) & Chr(col + 1) & "1")

    End If

col = col + 2
Loop

End Sub

You must log in to answer this question.