Copy data from Sheet 2 to Sheet1 and paste it in alternate rows in a new sheet

zaveedd

New Member
Joined
Apr 23, 2021
Messages
6
Office Version
  1. 2016
  2. 2010
Platform
  1. Windows
Hi,

I have data in 2 sheets . sheet1 and sheet2 are the sheet names. Data is available A to M in both the sheets.

Both will have same data except 1will have positive value the other will have Negative value.

Both the sheets have row headers .want the output in a new sheet with 2nd row from sheet 1 and 2nd row from sheet 2 ,.3rd row sheet 1 ,3rd row sheet 2 etc. Find below a sample image.

Can anybody help me with the VBA code to get this accomplished?
 

Attachments

  • Query.JPG
    Query.JPG
    119 KB · Views: 5

Marc L

Well-known Member
Joined
Apr 5, 2021
Messages
927
Office Version
  1. 2010
Platform
  1. Windows
No I can't reach it but maybe someone else could …​
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Marc L

Well-known Member
Joined
Apr 5, 2021
Messages
927
Office Version
  1. 2010
Platform
  1. Windows
A VBA demonstration as a beginner starter :​
VBA Code:
Sub Demo1()
        If Sheets.Count < 3 Then Sheets.Add , Sheets(2) Else Sheets(3).UsedRange.Clear
        Application.ScreenUpdating = False
    With Sheets(1).UsedRange.Rows
           .Item("1:2").Copy Sheets(3).[A1]
            L& = 2
        For R& = 3 To .Count
            L = L + 2
           .Item(R).Copy Sheets(3).Cells(L, 1)
        Next
    End With
    With Sheets(2).UsedRange.Rows
            L = 1
        For R = 2 To .Count
            L = L + 2
           .Item(R).Copy Sheets(3).Cells(L, 1)
        Next
    End With
        Application.ScreenUpdating = True
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,132,913
Messages
5,655,919
Members
418,253
Latest member
TheJackal26

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top