Re : Macro condition si cellule fusionnée dans une colonne
Bonsoir Danreb,
En effet c'est exactement ça, mais j'ai réussit à "bricoler" un code me permettant de faire les retraitements qui me sont nécessaires ensuite.
Mon unique soucis consiste dans le cas n°2, cas de figure de présentation du fichier original brut que je reçois, pour lequel je souhaite donc que la boucle que vous m'aviez trouvée soit adaptée.
En vous remerciant encore une fois.
Cordialement.
Pour info, voici ce code, qui fera sans doute bondir au plafond les puristes du forum
, mais le principal étant qui fonctionne:
submacroforum
Dim nblignes As String
Dim cel As Range, ins As Range
Dim DernLigne As Long
Application.ScreenUpdating = False
Range("B65536").End(xlUp).Offset(1, 0).Select
ActiveCell.Offset(0, 6).Select
ActiveCell.FormulaR1C1 = "lastligne"
Dim Plg As Range, L As Long
Set Plg = ActiveSheet.UsedRange
For L = Plg.Rows.Count To 2 Step -1
If Plg(L, 1).MergeCells And Plg(L, 1).MergeArea.Row = Plg.Rows(L).Row Then
Plg(L, 1).MergeArea.UnMerge
Plg(L + 1, 1).Value = Plg(L, 1).Value
Plg(L + 1, 2).Value = Plg(L, 2).Value & " " & Plg(L + 1, 2).Value
Plg.Rows(L).EntireRow.Delete
End If
Next L
Range("C4").Select
Selection.Copy
Range("C5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("D3").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=R[1]C&"" ""&R[2]C&"" ""&R[3]C"
Range("D3").Select
Selection.Copy
Range("E3").Select
ActiveSheet.Paste
Range("F3").Select
ActiveSheet.Paste
Range("D3:F3").Select
Application.CutCopyMode = False
Selection.Copy
Range("D5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("D6:F6").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("D3:F3").Select
Selection.ClearContents
Range("C4").Select
Selection.ClearContents
nblignes = Range("G1", [G1].End(xlDown)).Rows.Count
Cells.Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("A:A").Select
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
Range("G1").Select
ActiveCell.FormulaR1C1 = "=R1C1"
Range("G2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-4]="""",""OK"",""NOT"")"
Range("G2").Select
Selection.Copy
[G2].AutoFill Destination:=Range("G2:G" & Range("B65536").End(xlUp).Row)
ActiveSheet.Range("G2:G" & Range("B65536").End(xlUp).Row).AutoFilter Field:=1, Criteria1:="=OK", _
Operator:=xlAnd
[G3:G65000].SpecialCells(xlCellTypeVisible).EntireRow.Delete
Cells.Select
Selection.AutoFilter
Range("G1").Select
ActiveCell.FormulaR1C1 = "=R1C1"
Range("G2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-6]="""",""OK"",""NOT"")"
Range("G2").Select
Selection.Copy
[G2].AutoFill Destination:=Range("G2:G" & Range("B65536").End(xlUp).Row)
ActiveSheet.Range("G1:G" & Range("B65536").End(xlUp).Row).AutoFilter Field:=1, Criteria1:="=OK", _
Operator:=xlAnd
[G2:G65000].SpecialCells(xlCellTypeVisible).EntireRow.Delete
Cells.Select
Selection.AutoFilter
Range("G2").Select
ActiveCell.FormulaR1C1 = "=IF(OR(RC[-6]=""CCY"",RC[-6]=""DEVISE""),""OK"",""NOT OK"")"
Range("G2").Select
Selection.Copy
[G2].AutoFill Destination:=Range("G2:G" & Range("B65536").End(xlUp).Row)
ActiveSheet.Range("G1:G" & Range("B65536").End(xlUp).Row).AutoFilter Field:=1, Criteria1:="=OK", _
Operator:=xlAnd
[G2:G65000].SpecialCells(xlCellTypeVisible).EntireRow.Delete
Cells.Select
Selection.AutoFilter