Hi there,
I am trying to select informations from sheets 2 to 50. (They do not necessarily exist, I just want the code to run throught all the sheets if I have created a sheet of that name) and paste it to the first sheet of my Workbook.
What I want is for the MAcro to pick stuff from that sheet and then paste it from to the sheet called Factures. There are a few ranges to copy and paste to this Factures sheet, and then , I want the Macro to go to the next sheet in the workbook and copy the same ranges and paste it on that same Factures sheet, but 10 rows lower. And on and on until there's no more Sheets to be found.
I've tried this code...
Sub factures()
Dim i As Integer, m As Integer
i = 2 to 50
m = 5
For i = 2 To 50
Sheets("i").Select
Range("C14:C23").Select
Selection.Copy
Sheets("Factures").Select
Cells(m, 9).Select
Selection.PasteSpecial xlPasteFormulas
Sheets("i").Select
Range("D14:H23").Select
Selection.Copy
Sheets("Facture").Select
Range(Cells(m, 4), Cells(m, 8)).Select
Selection.PasteSpecial xlPasteFormulas
Sheets("i").Select
Range("I14:I23").Select
Selection.Copy
Sheets("Factures").Select
Cells(m, 10).Select
Selection.PasteSpecial xlPasteFormulas
Sheets("i").Select
Range("I3:J3").Select
Selection.Copy
Sheets("Factures").Select
Range(Cells(m + 3, 1), Cells(m + 3, 2)).Select
Selection.PasteSpecial xlPasteFormulas
Sheets("i").Select
Range("I4:J4").Select
Selection.Copy
Sheets("Factures").Select
Range(Cells(m + 5, 1), Cells(m + 5, 2)).Select
Selection.PasteSpecial xlPasteFormulas
m = m + 10
Next i
End Sub
And it dosen't work.
Any ideas?!?
Cheers,
I am trying to select informations from sheets 2 to 50. (They do not necessarily exist, I just want the code to run throught all the sheets if I have created a sheet of that name) and paste it to the first sheet of my Workbook.
What I want is for the MAcro to pick stuff from that sheet and then paste it from to the sheet called Factures. There are a few ranges to copy and paste to this Factures sheet, and then , I want the Macro to go to the next sheet in the workbook and copy the same ranges and paste it on that same Factures sheet, but 10 rows lower. And on and on until there's no more Sheets to be found.
I've tried this code...
Sub factures()
Dim i As Integer, m As Integer
i = 2 to 50
m = 5
For i = 2 To 50
Sheets("i").Select
Range("C14:C23").Select
Selection.Copy
Sheets("Factures").Select
Cells(m, 9).Select
Selection.PasteSpecial xlPasteFormulas
Sheets("i").Select
Range("D14:H23").Select
Selection.Copy
Sheets("Facture").Select
Range(Cells(m, 4), Cells(m, 8)).Select
Selection.PasteSpecial xlPasteFormulas
Sheets("i").Select
Range("I14:I23").Select
Selection.Copy
Sheets("Factures").Select
Cells(m, 10).Select
Selection.PasteSpecial xlPasteFormulas
Sheets("i").Select
Range("I3:J3").Select
Selection.Copy
Sheets("Factures").Select
Range(Cells(m + 3, 1), Cells(m + 3, 2)).Select
Selection.PasteSpecial xlPasteFormulas
Sheets("i").Select
Range("I4:J4").Select
Selection.Copy
Sheets("Factures").Select
Range(Cells(m + 5, 1), Cells(m + 5, 2)).Select
Selection.PasteSpecial xlPasteFormulas
m = m + 10
Next i
End Sub
And it dosen't work.
Any ideas?!?
Cheers,