Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

concaténation de macro

1 réponse
Avatar
marc
Bonjour à vous tous.
J'ai trois macros qui fonctionnent parfaitement séparément.
Dans mon fichier Excel, j'ai 3 boutons.
J'aimerais en avoir qu'un seul qui ferait les 3 macros suivants:
Merci de votre aide
---
Sub Supprimer_les_lignes_vides()
Range("A1:A65536").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
---
(Macro fait par Isabelle dans un autre post)
Sub Macro1()
For Each c In Selection
For i = Len(c) To 1 Step -1
zz = Mid(c, i, 1)
If Not c.Offset(0, 2) <> "" Then
If Mid(c, i, 1) <> Chr(160) Then
X = Mid(c, i, 1) & X
Else
c.Offset(0, 2) = X
X = ""
GoTo suivant
End If

Else
suivant:
If Mid(c, i, 1) <> "," Then
X = Mid(c, i, 1) & X
Else
c.Offset(0, 1) = X
X = ""
Exit For
End If
End If

Next
Next
End Sub
---
Sub conflit()
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("A1").Select
ActiveCell.FormulaR1C1 = "Compagnie"
Range("B1").Select
ActiveCell.FormulaR1C1 = "Ville"
Range("C1").Select
ActiveCell.FormulaR1C1 = "Pays"
Range("A1:C1").Select
Selection.Font.Bold = True
Range("D11").Select
End Sub

1 réponse

Avatar
MichDenis
Bonjour Marc,

Tu crées une macro en interpelant les macros déjà réalisées
dans l'ordre que tu désires et tu l'affectes à ton bouton.

'-------------------------------
Sub MaMacro()
Supprimer_les_lignes_vides
Macro1
conflit
End Sub
'-------------------------------


"marc" a écrit dans le message de groupe de discussion :

Bonjour à vous tous.
J'ai trois macros qui fonctionnent parfaitement séparément.
Dans mon fichier Excel, j'ai 3 boutons.
J'aimerais en avoir qu'un seul qui ferait les 3 macros suivants:
Merci de votre aide
---
Sub Supprimer_les_lignes_vides()
Range("A1:A65536").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
---
(Macro fait par Isabelle dans un autre post)
Sub Macro1()
For Each c In Selection
For i = Len(c) To 1 Step -1
zz = Mid(c, i, 1)
If Not c.Offset(0, 2) <> "" Then
If Mid(c, i, 1) <> Chr(160) Then
X = Mid(c, i, 1) & X
Else
c.Offset(0, 2) = X
X = ""
GoTo suivant
End If

Else
suivant:
If Mid(c, i, 1) <> "," Then
X = Mid(c, i, 1) & X
Else
c.Offset(0, 1) = X
X = ""
Exit For
End If
End If

Next
Next
End Sub
---
Sub conflit()
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("A1").Select
ActiveCell.FormulaR1C1 = "Compagnie"
Range("B1").Select
ActiveCell.FormulaR1C1 = "Ville"
Range("C1").Select
ActiveCell.FormulaR1C1 = "Pays"
Range("A1:C1").Select
Selection.Font.Bold = True
Range("D11").Select
End Sub