bonjour,
Sub Onglet2()
With Sheets("Sheet2")
Set c = .Range("A29:M35")
aa = c.Value2
If Len(aa(1, 1)) = 0 Then MsgBox "vide": Exit Sub
r = Application.Match(aa(1, 1), .Rows(1), 0)
If IsNumeric(r) Then
With .Cells(1, r).Resize(UBound(aa, 2), UBound(aa))
.Value = Application.Transpose(aa)
.HorizontalAlignment = xlCenter
.Resize(2).Font.Bold = True
.Resize(1).NumberFormat = "dd/mm/yy"
.Offset(2).Resize(UBound(aa, 2) - 2).NumberFormat = " #,##0"
.Resize(2).Font.FontStyle = IIf(Application.UserName = "BSA", "vet", "gras")
.Resize(2).Interior.ColorIndex = xlgrey
.Borders.LineStyle = xlContinuous
End With
With c
.ClearContents
.Interior.ColorIndex = WorksheetFunction.RandBetween(3, 55)
End With
Else
MsgBox "date introuvable", vbCritical
End If
End With
End Sub