1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| Dim nomselect As String
Dim seuilaj As String
Dim popqtepas As Integer
Dim i As Integer
Dim itselect As Integer, itsupaj As Integer
Dim derligalea As Integer, endline As Integer, finlign As Integer
nomselect = InputBox("Veuillez renseigner le nom de l'échantillon :", "Nom de l'échantillon")
If nomselect = "" Then Exit Sub
seuilaj = Sheets("Base de données").Range("O5").Value
popqtepas = Sheets("Base de données").Range("O15").Value
itsupaj = Sheets("Base de données").Range("o9").Value
itselect = Sheets("Base de données").Range("O6").Value
derligalea = Sheets("Base de données").Range("O16").Value
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = nomselect
If itselect >= itsupaj Then
endline = ActiveWorkbook.ActiveSheet.Range("J65536").End(xlUp).Row
ActiveSheet.Range(Cells(2, 1), Cells(endline, 10)).Select
Selection.Copy
Sheets(nomselect).Select
ActiveSheet.Range("A56").PasteSpecial
Else
finlign = ActiveSheet.Range(Cells(derligalea, 1), Cells(derligalea, 10)).Row
For i = 2 To finlign Step popqtepas
ActiveSheet.Range(Cells(i, 1), Cells(i, 10)).Copy
Sheets(nomselect).Activate
endline = ActiveSheet.Range("J65536").End(xlUp).Row
Activesheet.Range(Cells(endline + 1, 1), Cells(endline + 1, 10)).PasteSpecial
Sheets("Base de données").Select
Next i
End If |
Partager