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
| Sub test()
Dim VarLigne As Range
Dim DestinationLigne As Integer
Set Lom = Workbooks("List Of materials").Worksheets("sheet1")
Set Final = ThisWorkbook.Worksheets("Sheet1")
DestinationLigne = Final.Cells(Rows.Count, 1).End(xlUp).Row
DestinationDeDepart = DestinationLigne
If DestinationLigne < 13 Then DestinationLigne = 13
For Each VarLigne In Selection.Rows
DestinationLigne = DestinationLigne + 1
If DestinationLigne > DestinationDeDepart + 27 Then
MsgBox "this Request for Writeoff is full, Please save and use a new one"
Exit Sub
End If
Final.Cells(DestinationLigne, 1) = Lom.Cells(VarLigne, 1)
Final.Cells(DestinationLigne, 2) = Lom.Cells(VarLigne, 6)
Final.Cells(DestinationLigne, 3) = Lom.Cells(VarLigne, 7)
Final.Cells(DestinationLigne, 4) = Lom.Cells(VarLigne, 5)
Final.Cells(DestinationLigne, 5) = Lom.Cells(VarLigne, 2)
Final.Cells(DestinationLigne, 7) = Lom.Cells(VarLigne, 9)
Next
Final.Cells(2, 1) = "NAME OF PERSON REQUESTING WRITE OFF: Ced"
Final.Cells(4, 1) = "DATE : " & Date
End Sub |
Partager