1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Sub testCopierColler()
Dim xlWbk As Workbook
Dim xlWshFrom As Worksheet, xlWshTo As Worksheet
Dim rngFrom As Range, rCell As Range
Dim strDate As String
Set xlWbk = ThisWorkbook
Set xlWshTo = xlWbk.Worksheets("Gantt")
Set xlWshFrom = xlWbk.Worksheets("RàF")
strDate = xlWshTo.Range("Date_Déb")
strDate = Format(strDate, "dd/mm/yyyy")
xlWshFrom.Select
Set rCell = xlWshFrom.Range("C1:Z1").Find(What:=CDate(strDate), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If rCell Is Nothing Then
MsgBox ("Pas de date correspondante !")
Else
Set rngFrom = xlWshFrom.Range(Cells(4, rCell.Column), Cells(31, rCell.Column))
rngFrom.Copy xlWshTo.Range("G10")
xlWshTo.Select
End If
End Sub |
Partager