Private Sub Worksheet_Activate()
UsedRange.Columns(1) = UsedRange.Columns(1).Value 'les formules en colonne M sont recalculées
End Sub
Public Function FindCustom(ByVal FindValue As Variant) As Excel.Range
Dim wks As Excel.Worksheet
Dim rngResult As Excel.Range
For Each wks In ThisWorkbook.Worksheets
Set rngResult = wks.UsedRange.Find( _
What:=FindValue, _
LookIn:=XlFindLookIn.xlValues, _
LookAt:=XlLookAt.xlWhole, _
SearchOrder:=XlSearchOrder.xlByRows, _
SearchDirection:=XlSearchDirection.xlNext, _
MatchCase:=True)
If Not rngResult Is Nothing Then
If FindCustom Is Nothing Then
Set FindCustom = rngResult
If Not wks.UsedRange.FindNext(FindCustom) Is Nothing Then
If wks.UsedRange.FindNext(FindCustom).Address <> FindCustom.Address Then
Call MsgBox("Erreur : valeur en doublon dans l'onglet.")
Set FindCustom = Nothing: Exit Function
End If
End If
Else
Call MsgBox("Erreur : valeur déjà trouvée dans un autre onglet")
Set FindCustom = Nothing: Exit Function
End If
End If
Next wks
End Function
Function SEM(cours As String, separateur As String)
Application.Volatile
Dim w As Worksheet, nom As String
For Each w In Worksheets
nom = UCase(w.Name)
If nom Like "SEM*#" Then If Application.CountIf(w.Columns(3), cours) _
Then SEM = SEM & separateur & Val(Replace(nom, "SEM", ""))
Next
SEM = Mid(SEM, Len(separateur) + 1)
If IsNumeric(SEM) Then SEM = Val(SEM)
End Function
Private Sub Worksheet_Activate()
UsedRange.Columns(1) = UsedRange.Columns(1).Value 'les formules en colonne M sont recalculées
End Sub
Cela ne fera que compliquer inutilement les choses, restez avec SEM 1 et SEM2 ou SEM 01 et SEM 02.C'est vrai mais je voulais nommer les onglets SEM (1) SEM (2) ...