Bonsoir le forum,
Je vous contact car j'ai une macro qui plante , je ne trouve pas l'erreur.
La voici :
Elle fonctionne mais me crée 2 colonnes ( je ne sais pas pourquoi )
Et la suppression des cellules ne marche pas
Pourriez vous m'aider ?
Je vous contact car j'ai une macro qui plante , je ne trouve pas l'erreur.
La voici :
Code:
Public premier As Boolean
Sub Macro12()
'
' Macro12 Macro
'
' Touche de raccourci du clavier: Ctrl+n
On Error Resume Next
Dim wb As Workbook
For Each wb In Workbooks
If wb.Name Like "Analyse*" Then
wb.Sheets("Feuil1").Select
wb.Sheets("Feuil1").Move Before:=Sheets(1)
wb.Sheets("Concaténation").Select
For i = 1 To wb.Sheets.Count
wb.Sheets("Concaténation").Select
Selection.wb.Sheets(i).Range("a1:a65536").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Next i
Columns("A:A").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
End If
If premier = False Then
monID = 0
End If
j = 1
k = 1
derniereLigne = wb.Sheets("Feuil1").Range("B65536").End(xlUp).Row
For i = 1 To derniereLigne
If wb.Sheets(1).Cells(i, 1).Value <> "" Then
monID = monID + 1
valeur = Sheets("Feuil1").Cells(i, 1).Value
wb.Sheets("Concaténation").Cells(j, 1).Value = monID
wb.Sheets("Concaténation").Cells(j, 2).Value = Sheets("Feuil1").Cells(i, 1).Value
j = j + 1
End If
wb.Sheets("Feuil2").Cells(k, 1).Value = monID
wb.Sheets("Feuil2").Cells(k, 2).Value = Sheets("Feuil1").Cells(i, 2).Value
k = k + 1
Next
wb.Sheets("Concaténation").Name = "Danger"
wb.Sheets("Feuil2").Name = "Mesure"
Next wb
On Error GoTo 0
End Sub
Elle fonctionne mais me crée 2 colonnes ( je ne sais pas pourquoi )
Et la suppression des cellules ne marche pas
Pourriez vous m'aider ?