Sheets.Add.Name = Sheets("TEST").Name & " " & Sheets("TEST").Range("A1") & " plage " & num
ActiveWorkbook.Sheets.Add after:=Worksheets(Worksheets.Count)
ActiveSheet.Name = Sheets("TEST").Name & " " & Sheets("TEST").Range("A1") & " plage " & num
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Wb As Workbook
Dim Ws As Worksheet
Dim x As Variant
On Error Resume Next
If Not Application.Intersect(Target, Range("A2:A42")) Is Nothing Then
For Each Wb In Application.Workbooks
For Each Ws In Wb.Worksheets
For Each x In ThisWorkbook
Set x = Ws.Cells.Find(Target)
If Not x Is Nothing Then
Ws.Select
x.Select
End If
Next x
Next Ws
Next Wb
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
num = Int((Target.Row + 1) / 3)
If Target.Column = 1 And Target.Row >= 2 And Target.Row <= Cells(65536, 1).End(xlUp).Row Then
feuille = ActiveSheet.Name & " " & ActiveSheet.Range("A1") & " plage " & num
Set c = Sheets(feuille).Columns(2).Find(Target.Value, LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
Sheets(feuille).Select
c.Select
End If
End If
End Sub
Sub Test()
Application.ScreenUpdating = False
num = 1
Col = CInt(InputBox("entre le numéo de la colonne (1, 3, 5 ou 7)"))
If Not IsNumeric(Col) Or Col = "" Then Exit Sub
With Sheets("Test")
Feuille = .Cells(1, Col).Value
For n = 2 To .Cells(1, Col + 1).Value Step 3
Sheets("Feuille de MAT vierge").Copy after:=Sheets(Sheets.Count)
With ActiveSheet
.Name = Feuille & " page " & num
Lien = .Name
.Range("B8") = Sheets("TEST").Cells(n, Col)
.Range("B20") = Sheets("TEST").Cells(n + 1, Col)
.Range("B31") = Sheets("TEST").Cells(n + 2, Col)
End With
.Hyperlinks.Add Anchor:=.Cells(n, Col), Address:="", SubAddress:= _
"'" & Lien & "'!B8", TextToDisplay:=.Cells(n, Col).Text
.Hyperlinks.Add Anchor:=.Cells(n + 1, Col), Address:="", SubAddress:= _
"'" & Lien & "'!B20", TextToDisplay:=.Cells(n + 1, Col).Text
.Hyperlinks.Add Anchor:=.Cells(n + 2, Col), Address:="", SubAddress:= _
"'" & Lien & "'!B31", TextToDisplay:=.Cells(n + 2, Col).Text
num = num + 1
Next n
End With
Application.ScreenUpdating = True
End Sub