Lien vers une cellule
Hello
Je n'arrive pas à créer un lien vers une cellule dans mon code ?
j'aimerai que quand je click sur un lien, la cellule de destination soit sectionnée ?
Les liens fonctionnent, ça ouvre bien la bonne page mais c'est la cellule A12 qui prend le focus ?
A priori, il faut passer par la méthode :
Sheets("Suivi").Hyperlinks.Add Anchor:=Sheets("Suivi").Cells(t, 1), Address:="", SubAddress:= _
"MA!A" & CStr(i), TextToDisplay:=Cells(i, 1)
mais je n'y arrive pas j'ai une erreur d'exécution 5
Sub trier()
Dim i, t As Integer
Dim x As String
i = 12
t = 12
Sheets("MA").Select
Do While Cells(i, 1) <> "" Or Cells(i, 2) <> "" Or Cells(i, 3) <> "" Or Cells(i, 4) <> "" Or Cells(i, 5) <> "" Or Cells(i, 6) <> ""
If Cells(i, 5) = "En cours" Or Cells(i, 5) = "A faire" Or Cells(i, 5) = "reçu acompte" Or Cells(i, 5) = "Acompte" Then
Rows(i).Copy Sheets("Suivi").Rows(t)
Sheets("Suivi").Cells(t, 1).FormulaLocal = "=LIEN_HYPERTEXTE(" & Chr(34) & Chr(91) & Chr(35) & Chr(93) & "MA!A" _
& CStr(i) & Chr(34) & ";" & Chr(34) & Cells(i, 1) & Chr(34) & Chr(41)
Sheets("MA").Select
t = t + 1
End If
i = i + 1
Loop
end sub
Hello
J'ai trouvé
je poste, ça peux servir
Sub trier()
Application.ScreenUpdating = False
Dim i, t As Integer
Dim x As String
i = 12
t = 12
Sheets("MA").Select
Do While Cells(i, 1) <> "" Or Cells(i, 2) <> "" Or Cells(i, 3) <> "" Or Cells(i, 4) <> "" Or Cells(i, 5) <> "" Or Cells(i, 6) <> ""
If Cells(i, 5) = "En cours" Or Cells(i, 5) = "A faire" Or Cells(i, 5) = "reçu acompte" Or Cells(i, 5) = "Acompte" Then
Rows(i).Copy Sheets("Suivi").Rows(t)
Sheets("Suivi").Hyperlinks.Add Anchor:=Sheets("Suivi").Cells(t, 1), Address:="", SubAddress:="MA!A" & CStr(i)
'Sheets("MA").Select
t = t + 1
End If
i = i + 1
Loop
Sheets("CH").Select
i = 12
Do While Cells(i, 1) <> "" Or Cells(i, 2) <> "" Or Cells(i, 3) <> "" Or Cells(i, 4) <> "" Or Cells(i, 5) <> "" Or Cells(i, 6) <> ""
If Cells(i, 5) = "En cours" Or Cells(i, 5) = "A faire" Or Cells(i, 5) = "reçu acompte" Or Cells(i, 5) = "Acompte" Then
Rows(i).Copy Sheets("Suivi").Rows(t)
Sheets("Suivi").Hyperlinks.Add Anchor:=Sheets("Suivi").Cells(t, 1), Address:="", SubAddress:="CH!A" & CStr(i)
'Sheets("CH").Select
t = t + 1
End If
i = i + 1
Loop
Sheets("CO_ET").Select
i = 12
Do While Cells(i, 1) <> "" Or Cells(i, 2) <> "" Or Cells(i, 3) <> "" Or Cells(i, 4) <> "" Or Cells(i, 5) <> "" Or Cells(i, 6) <> ""
If Cells(i, 5) = "En cours" Or Cells(i, 5) = "A faire" Or Cells(i, 5) = "reçu acompte" Or Cells(i, 5) = "Acompte" Then
Rows(i).Copy Sheets("Suivi").Rows(t)
Sheets("Suivi").Hyperlinks.Add Anchor:=Sheets("Suivi").Cells(t, 1), Address:="", SubAddress:="CO_ET!A" & CStr(i)
'Sheets("CO_ET").Select
t = t + 1
End If
i = i + 1
Loop
Sheets("Suivi").Select
t = t - 1
x = "$A$11:$T$" & CStr(t)
Application.ScreenUpdating = True
End Sub