vvkalkundri
New Member
- Joined
- May 10, 2009
- Messages
- 3
Hi ,
I have a excel sheet where i want to copy the Cells from 1 excel sheet to other excel sheet in a specific order using macro.
copy A1:D1 in sheet1 and paste it to A1:D1 in sheet2.
Copy E1:F1 in sheet1 and paste it to A2:D2 in Sheet2 .
Copy G1:H1 in sheet1 and paste it to A3:D3 in Sheet2 .
Copy I1:H1 in sheet1 and paste it to A4:D4 in Sheet2 .
I want to repeat this operation for all the rows in the sheet ? How to go about this . I have a sample code. How to loop through the entire sheet ?
Saple code :
Sub Macro1()
Sheets("Sheet1").Select
Range("A1:C1").Select
Selection.Copy
Sheets("Sheet3").Select
Range("Ai:Ci").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("D1:F1").Select
Selection.Copy
Sheets("Sheet3").Select
Range("A2").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("A2:C2").Select
Selection.Copy
Sheets("Sheet3").Select
Range("A3").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("D2:F2").Select
Selection.Copy
Sheets("Sheet3").Select
Range("A4").Select
ActiveSheet.Paste
End Sub
I have a excel sheet where i want to copy the Cells from 1 excel sheet to other excel sheet in a specific order using macro.
copy A1:D1 in sheet1 and paste it to A1:D1 in sheet2.
Copy E1:F1 in sheet1 and paste it to A2:D2 in Sheet2 .
Copy G1:H1 in sheet1 and paste it to A3:D3 in Sheet2 .
Copy I1:H1 in sheet1 and paste it to A4:D4 in Sheet2 .
I want to repeat this operation for all the rows in the sheet ? How to go about this . I have a sample code. How to loop through the entire sheet ?
Saple code :
Sub Macro1()
Sheets("Sheet1").Select
Range("A1:C1").Select
Selection.Copy
Sheets("Sheet3").Select
Range("Ai:Ci").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("D1:F1").Select
Selection.Copy
Sheets("Sheet3").Select
Range("A2").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("A2:C2").Select
Selection.Copy
Sheets("Sheet3").Select
Range("A3").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("D2:F2").Select
Selection.Copy
Sheets("Sheet3").Select
Range("A4").Select
ActiveSheet.Paste
End Sub