Sub Traite_casse(Comment As String, mode As Long)
Dim Cellule As Range, LastRow As Long, rng As Range, t$, fx$, area, rng2 As Range
Set rng = Selection
If rng.Cells.Count < 1 Then MsgBox "Vous devez sélectionner au moins une cellule pour appliquer cette macro", vbInformation: Exit Sub
LastRow = ActiveSheet.UsedRange.Rows.Count
Select Case mode
Case 1: Set rng = rng
Case 2: Set rng = Cells(2, rng.Column).Resize(LastRow - 1, 1)
Case 3:
If rng.Areas.Count = 1 Then
Set rng = rng.Resize(LastRow - 1, rng.Columns.Count)
Else
Set rng2 = rng.Areas(1).Cells(1).Resize(LastRow, 1)
For Each area In rng.Areas: Set rng2 = Union(rng2, area.Cells(1).Resize(LastRow, 1)): Next
Set rng = rng2
End If
End Select
t = "application sur " & rng.Address(0, 0) & " de la fonction"
If rng.Rows.Count > 1000 Then
If MsgBox("Ca va prendre du temps sur : " & Format(Selection.Rows.Count, "#0,000,000") & " Cellules" & vbCrLf & "Voulez-vous continuer ?", vbOKCancel) = vbCancel Then Exit Sub
End If
For Each Cellule In rng
If Not IsError(Cellule) Then
Select Case Comment
Case "maj": Cellule = UCase(Cellule): fx = " Majucucule"
Case "Npropre": Cellule = Application.Proper(Cellule): fx = " Nom Propre"
Case "min": Cellule = LCase(Cellule): fx = " Minuscule "
End Select
End If
Next Cellule
Application.StatusBar = t & fx
End Sub