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
|
Sub Test()
Dim Plage As Range
Set Plage = DefPlage(Sheets("DAY-PIVOT"), 1, 1)
With Sheets("DAY_OPT")
.Range(.Cells(1, 1), .Cells(Plage.Rows.Count, Plage.Columns.Count)).Value = Plage.Value
.Range(.Cells(1, 1), .Cells(Plage.Rows.Count, Plage.Columns.Count)).Replace "-", "/"
'ou encore :
'.Range(.Cells(1, 1), .Cells(Plage.Rows.Count, Plage.Columns.Count)).NumberFormat = "dd/mm/yyyy"
End With
End Sub
Function DefPlage(Fe As Worksheet, Optional L As Long = 1, Optional C As Long = 1) As Range
On Error GoTo Fin
With Fe
Set DefPlage = .Range(.Cells(L, C), _
.Cells(.Cells.Find("*", .[A1], -4123, , _
1, 2).Row, .Cells.Find("*", .[A1], -4123, , _
2, 2).Column))
End With
Exit Function
Fin:
Set DefPlage = Nothing
End Function |
Partager