Microsoft 365 Diff entre Array et Formule

iliess

XLDnaute Occasionnel
bonjour
j'ai essaye de crée une clé apartir d'une plage Arr
j'ai essayé deux méthode la premiere par Array et la deuxième par formule
j'ai constaté que la macro par formule et rapide que Array

Svp comment je peux accélère la méthode Array
 
Dernière modification par un modérateur:

ChTi160

XLDnaute Barbatruc
Re
j'ai modifié ta Version avec Formule et ca semble bien plus rapide à Voir !
VB:
Sub Traitement_par_formule()
T = Timer
With Application
        '.Calculation = xlCalculationManual
        .EnableEvents = False
        .ScreenUpdating = False
End With

Dim ShRaw As Worksheet
Dim LShRaw As Long
Dim Brr As Variant

'=============================================================
Set ShRaw = ThisWorkbook.Worksheets("Feuil1")
LShRaw = ShRaw.Cells(ShRaw.Rows.Count, 1).End(xlUp).Row
Brr = ShRaw.Range("A2:H" & LShRaw)
'==================================================================================================================================
With ShRaw
      If .FilterMode Then .ShowAllData
      .Cells(1, "I") = "Clé"
      .Cells(2, "I").Resize(LShRaw) = "=""445""&""_""&A2&""_""&C2&""_""&D2&""_""&F2&""_""&G2"
      .Cells(1, "I").Resize(LShRaw) = .Cells(1, "i").Resize(LShRaw).Value
End With

With Application
        '.Calculation = xlCalculationAutomatic
        .EnableEvents = True
        .ScreenUpdating = True
End With
MsgBox Timer - T

End Sub
Jean marie
 

iliess

XLDnaute Occasionnel
VB:
Sub Traitement_par_Array_plus()
t = Timer

With Application
        .Calculation = xlCalculationManual
        .EnableEvents = False
        .ScreenUpdating = False
End With

Dim ShRaw As Worksheet
Dim LShRaw As Long
Dim Brr As Variant, A As Variant
'=============================================================
Set ShRaw = ThisWorkbook.Worksheets("Raw")
LShRaw = ShRaw.Cells(ShRaw.Rows.Count, 1).End(xlUp).row
Brr = ShRaw.Range("A2:H" & LShRaw)
'==================================================================================================================================
ReDim A(1 To 1, 1 To UBound(Brr))
For i = LBound(Brr) To UBound(Brr)
A(1, i) = "445" & "_" & Brr(i, 1) & "_" & Brr(i, 3) & "_" & Brr(i, 4) & "_" & Brr(i, 6) & "_" & Brr(i, 7)
Next i
Range("i2:i" & LShRaw).Value = A

With Application
        .Calculation = xlCalculationAutomatic
        .EnableEvents = True
        .ScreenUpdating = True
End With
MsgBox Timer - t

End Sub


Voici une solution plus rapide
 

Discussions similaires

Réponses
16
Affichages
591
Réponses
13
Affichages
602

Statistiques des forums

Discussions
312 613
Messages
2 090 233
Membres
104 456
dernier inscrit
mango53200