Copy Rows from SheetA,B&C and paste in SheetD

Closed
Cowshal Posts 2 Registration date Thursday August 20, 2009 Status Member Last seen August 24, 2009 - Aug 21, 2009 at 03:08 AM
Cowshal Posts 2 Registration date Thursday August 20, 2009 Status Member Last seen August 24, 2009 - Aug 24, 2009 at 05:52 AM
Hello Experts,


I am a novice in using VBA or Macros in excel. I need a help in copying all the available rows from Individual Sheet say A, B & C that needs to be copied to Sheet D in the given below fashion in a Worksheet:

In Sheet A: Copy Row1
In Sheet B: Copy Row1
In Sheet C: Copy Row1

Output Results in Sheet D should be:
Sheet A: Row1
Sheet B: Row1
Sheet C: Row1

I have around 4224 rows in Sheets A, B & C that needs to be copied to Sheet D. Hope i have explained what i am looking at above clearly. If you need any clarifications then, please let me know.

Your help would be greatly appreciated...

Thanking a lot in advance...


Thanks & Regards,
Cowshal

1 response

Cowshal Posts 2 Registration date Thursday August 20, 2009 Status Member Last seen August 24, 2009
Aug 24, 2009 at 05:52 AM
This is the piece of code that i have found that has worked nearest to the result i was expecting.

Private Sub CommandButton1_Click()
Dim x() As Variant
Dim y() As Variant

For i = 2 To 12672 Step 3

Worksheets("C").Rows(i + 1).EntireRow.Insert Shift:=xlDown
Worksheets("C").Rows(i + 1).EntireRow.Insert Shift:=xlDown
Next i

k = 3
For j = 2 To 4224

Sheets("C").Cells(k, 6).Value = Sheets("A").Cells(j, 4)
Sheets("C").Cells(k + 1, 6).Value = Sheets("B").Cells(j, 4)

k = k + 3
Next j
End Sub
0