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 49 50 51 52 53 54 55 56 57
| Private Sub CommandButton4_Click()
AutoFilterMode = False
Range("A5").AutoFilter
Bas = Range("A6").End(xlDown).Row
For Ligne = 6 To Bas
' Met a jour le lien si un no de page est indiqué
If Range("AF" & Ligne).Value <> "" Then
Worksheets("Listes").Range("K2").Value = Range("AE" & Ligne).Value
Fichier = Worksheets("Listes").Range("L2").Value
Page = "" & Range("AF" & Ligne).Value
ActiveSheet.Hyperlinks.Add Anchor:=Range("C" & Ligne), _
Address:=Fichier, SubAddress:=Page
' Supprime le lien si pas de no de page
Else
Range("C" & Ligne).Hyperlinks.Delete
End If
' Corrige la mise en forme
Set c = Range("C" & Ligne)
With c.Interior
.ColorIndex = Range("B" & Ligne).Interior.ColorIndex
.Pattern = xlSolid
End With
c.Borders(xlDiagonalDown).LineStyle = xlNone
c.Borders(xlDiagonalUp).LineStyle = xlNone
With c.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
With c.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With c.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With c.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
With c.Font
.Name = "Trebuchet MS"
.Size = 10
End With
Next
End Sub |
Partager