OVH Cloud OVH Cloud

Resultats de macro dans msgbox

Aucune réponse
Avatar
Gortex
Bonjour,
J'ai trouver cette macro qui recupere les differences de deux feuilles de deux classeur diferant dans la feuil 1 du classeur actif
je souhaite pouvour récuperer ces differences dans msgbox
Si vous avez une solution
Cordialement

Option Explicit

Private Sub cmdAnalyse_Click()
Dim strRepFicA As String, strRepFicB As String
Dim wbFicA As Workbook, wbFicB As Workbook, wbFicAna As Workbook
Dim wsFicA As Worksheet, wsFicB As Worksheet, wsFicAna As Worksheet
Dim lgLig As Long, lgCol As Long
Dim lgLigDeb As Long

strRepFicA = ThisWorkbook.Path & "" & "ALPHA.xls"
strRepFicB = ThisWorkbook.Path & "" & "BRAVO.xls"

Set wbFicAna = ThisWorkbook
Set wsFicAna = wbFicAna.ActiveSheet

If Dir(strRepFicA) = "" Or Dir(strRepFicB) = "" Then
MsgBox "Le fichier A et/ou le fichier B sont introuvables", vbCritical + vbOKOnly, "Problème de fichiers..."
Exit Sub
End If

Application.ScreenUpdating = False

Set wbFicA = Workbooks.Open(Filename:=ThisWorkbook.Path & "" & "ALPHA.xls")
Set wsFicA = wbFicA.Worksheets("Feuil1")

Set wbFicB = Workbooks.Open(Filename:=ThisWorkbook.Path & "" & "BRAVO.xls")
Set wsFicB = wbFicB.Worksheets("Feuil1")

wsFicAna.Range("A2:AO" & Cells.Rows.Count).ClearContents

lgLigDeb = 2

For lgLig = 2 To 1250
For lgCol = 4 To 41
If wsFicA.Cells(lgLig, lgCol).Value <> wsFicB.Cells(lgLig, lgCol).Value Then

wsFicAna.Range("A" & lgLigDeb).Value = wbFicA.Name
wsFicA.Range("A" & lgLig & ":" & "AO" & lgLig).Copy _
Destination:=wsFicAna.Range("D" & lgLigDeb + 1)

wsFicAna.Range("A" & lgLigDeb + 1).Value = wbFicB.Name
wsFicB.Range("A" & lgLig & ":" & "AO" & lgLig).Copy _
Destination:=wsFicAna.Range("D" & lgLigDeb)

lgLigDeb = lgLigDeb + 2

Exit For
End If
Next lgCol
Next lgLig

wbFicA.Close savechanges:=False
wbFicB.Close savechanges:=False

MsgBox "Traitement terminer"

Application.ScreenUpdating = True
End Sub

Réponses