Bonjour,

Je souhaiterais savoir s'il est possible de créer une fonction qui va enrichir les cellules d'un tableau excel avec le code ci dessous

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
            .Font.Bold = True               'titres caractères gras
            .Font.Size = 14
            .Interior.ColorIndex = 15
            .Interior.Pattern = xlSolid
            .VerticalAlignment = xlCenter
            .Borders(xlEdgeTop).LineStyle = xlDouble
            .Borders(xlEdgeTop).Weight = xlThick
            .Borders(xlEdgeTop).ColorIndex = xlAutomatic
            .Borders(xlEdgeBottom).LineStyle = xlDouble
            .Borders(xlEdgeBottom).Weight = xlThick
            .Borders(xlEdgeBottom).ColorIndex = xlAutomatic
            .Borders(xlEdgeLeft).LineStyle = xlDouble
            .Borders(xlEdgeLeft).Weight = xlThick
            .Borders(xlEdgeLeft).ColorIndex = xlAutomatic
            .Borders(xlEdgeRight).LineStyle = xlDouble
            .Borders(xlEdgeRight).Weight = xlThick
            .Borders(xlEdgeRight).ColorIndex = xlAutomatic
            .HorizontalAlignment = xlCenter
Sachant que j'intercalerais cete fonction (créé dans un module dans une fonction with :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
For J = 0 To rec.Fields.Count - 1
        xlSheet1.Cells(1, J + 1) = rec.Fields(J).Name
 
        With xlSheet1.Cells(1, J + 1)
  '. 
  '.  fonction Enrichissement de format aux cellules
  '.
        End With
    Next J
Merci d'avance

Marcopololo