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 43 44 45 46 47 48
| Option Explicit
Dim Tablo, Ln1, Ln2, Col, Col2
Dim dtdeb As Date
Dim dtfin As Date
Sub TabFe()
'Choix des colonnes du tableau à créer dans l'onglet TestTabFe.
Tablo = Array("B", "D", "F", "G", "H", "L", "M", "N")
Ln1 = 16
'La ligne n°16 correspond à la 1ère ligne de l'onglet Liste_FNC.
Ln2 = 2
'La ligne n°2 correspond à la 1ère ligne de l'onglet TestTabFe.
dtdeb = DateSerial(14, 01, 31)
dtfin = DateSerial(13, 12, 31)
While Cells(Ln1, 1).Value <> ""
If Range("B" & Ln1).Value = "KSB" And UCase(Range("AP" & Ln1).Value) = "OUI" And Range("N" & Ln1).Value <= dtdeb And Range("N" & Ln1).Value >= dtfin Then
Col2 = 0
For Each Col In Tablo
Sheets("TestTabFe").Cells(Ln2, Col2 + 1).Value = Range(Tablo(Col2) & Ln1).Value
Col2 = Col2 + 1
Next Col
Ln2 = Ln2 + 1
End If
Ln1 = Ln1 + 1
Wend
Sheets("TestTabFe").Activate
'Bordure Ligne.
Range("A1").CurrentRegion.Select
With Selection
.Borders.LineStyle = xlContinuous
End With
'Bordure Colonne.
With Range("A1:H" & Ln2 - 1)
.Borders(xlEdgeLeft).Weight = xlThin
.Borders(xlEdgeRight).Weight = xlThin
.Borders(xlEdgeTop).Weight = xlThin
.Borders(xlEdgeBottom).Weight = xlThin
.Borders(xlInsideVertical).Weight = xlThin
End With
End Sub |
Partager