XL 2016 Fusionner des cellules dans des colonnes

jymathieu

XLDnaute Nouveau
Bonjour,

Le fichier ci-joint est protéger, par défaut, par un mot de passe afin d'éviter que les utilisateurs qui vont travailler sur le fichier ne modifient les en-têtes.

Par contre en protégeant le fichier, il n'est pas possible de fusionner les données dans les colonnes.

Les données contenues dans les colonnes de A à E devront être fusionnées par les utilisateurs lorsque les données sont les mêmes sur les cellules A10 à A15 par exemple.

Comment faire pour que les utilisateurs puissent sélectionner un nombre de données identiques dans une colonne et qu'ensuite, ils cliquent sur un bouton pour qu'une macro dévérouille le fichier, fusionne les cellules sélectionnées et vérouille à nouveau le fichier?

Merci d'avance pour votre aide
 

Pièces jointes

  • merge cellules.xlsm
    32.8 KB · Affichages: 10
Solution
Bonsoir,
Il vaut mieux éviter de fusionner les colonnes ou lignes dans un tableau. Il vaut mieux utiliser les MFC pour masquer les données.
Cela permet de garder un tableau exploitable pour un TCD, Power query ou autres
Cordialement.

goube

XLDnaute Impliqué
Bonsoir,
Il vaut mieux éviter de fusionner les colonnes ou lignes dans un tableau. Il vaut mieux utiliser les MFC pour masquer les données.
Cela permet de garder un tableau exploitable pour un TCD, Power query ou autres
Cordialement.
 

Pièces jointes

  • merge cellules.xlsm
    27.7 KB · Affichages: 9

Dudu2

XLDnaute Barbatruc
Bonjour,
Je suis d'accord avec @goube, les cellules fusionnées c'est le début du chaos.

Mais si tu veux protéger la feuille, il y a des options dans la protection qui peuvent être ajustées.
La fusion relève, je pense du formatage des cellules

VB:
'Constante paramètres de protection des feuilles (https://docs.microsoft.com/fr-fr/office/vba/api/excel.worksheet.protect)
Public Const DrawingObjects = True
Public Const Contents = True
Public Const Scenarios = True
Public Const UserInterfaceOnly = False
Public Const AllowFormattingCells = True
Public Const AllowFormattingColumns = False
Public Const AllowFormattingRows = False
Public Const AllowInsertingColumns = False
Public Const AllowInsertingRows = False
Public Const AllowInsertingHyperlinks = False
Public Const AllowDeletingColumns = False
Public Const AllowDeletingRows = False
Public Const AllowSorting = True
Public Const AllowFiltering = True
Public Const AllowUsingPivotTables = False
'
Public const MotDePasse = "MotDePasse"
'
'------------------------
'Protection d'une feuille
'------------------------
Sub Protect(WS As Worksheet)
    WS.Protect Password:=MotDePasse, _
               DrawingObjects:=DrawingObjects, _
               Contents:=Contents, _
               Scenarios:=Scenarios, _
               UserInterfaceOnly:=UserInterfaceOnly, _
               AllowFormattingCells:=AllowFormattingCells, _
               AllowFormattingColumns:=AllowFormattingColumns, _
               AllowFormattingRows:=AllowFormattingRows, _
               AllowInsertingColumns:=AllowInsertingColumns, _
               AllowInsertingRows:=AllowInsertingRows, _
               AllowInsertingHyperlinks:=AllowInsertingHyperlinks, _
               AllowDeletingColumns:=AllowDeletingColumns, _
               AllowDeletingRows:=AllowDeletingRows, _
               AllowSorting:=AllowSorting, _
               AllowFiltering:=AllowFiltering, _
               AllowUsingPivotTables:=AllowUsingPivotTables
End Sub
 

jymathieu

XLDnaute Nouveau
Bonjour,
Je suis d'accord avec @goube, les cellules fusionnées c'est le début du chaos.

Mais si tu veux protéger la feuille, il y a des options dans la protection qui peuvent être ajustées.
La fusion relève, je pense du formatage des cellules

VB:
'Constante paramètres de protection des feuilles (https://docs.microsoft.com/fr-fr/office/vba/api/excel.worksheet.protect)
Public Const DrawingObjects = True
Public Const Contents = True
Public Const Scenarios = True
Public Const UserInterfaceOnly = False
Public Const AllowFormattingCells = True
Public Const AllowFormattingColumns = False
Public Const AllowFormattingRows = False
Public Const AllowInsertingColumns = False
Public Const AllowInsertingRows = False
Public Const AllowInsertingHyperlinks = False
Public Const AllowDeletingColumns = False
Public Const AllowDeletingRows = False
Public Const AllowSorting = True
Public Const AllowFiltering = True
Public Const AllowUsingPivotTables = False
'
Public const MotDePasse = "MotDePasse"
'
'------------------------
'Protection d'une feuille
'------------------------
Sub Protect(WS As Worksheet)
    WS.Protect Password:=MotDePasse, _
               DrawingObjects:=DrawingObjects, _
               Contents:=Contents, _
               Scenarios:=Scenarios, _
               UserInterfaceOnly:=UserInterfaceOnly, _
               AllowFormattingCells:=AllowFormattingCells, _
               AllowFormattingColumns:=AllowFormattingColumns, _
               AllowFormattingRows:=AllowFormattingRows, _
               AllowInsertingColumns:=AllowInsertingColumns, _
               AllowInsertingRows:=AllowInsertingRows, _
               AllowInsertingHyperlinks:=AllowInsertingHyperlinks, _
               AllowDeletingColumns:=AllowDeletingColumns, _
               AllowDeletingRows:=AllowDeletingRows, _
               AllowSorting:=AllowSorting, _
               AllowFiltering:=AllowFiltering, _
               AllowUsingPivotTables:=AllowUsingPivotTables
End Sub
Bonsoir,

Merci pour votre aide mais je sui assez nul en dev, je dois mettre ces commandes où pour que cela fonctionne?

Merci d'avance
 

jymathieu

XLDnaute Nouveau
Bonjour,
Je suis d'accord avec @goube, les cellules fusionnées c'est le début du chaos.

Mais si tu veux protéger la feuille, il y a des options dans la protection qui peuvent être ajustées.
La fusion relève, je pense du formatage des cellules

VB:
'Constante paramètres de protection des feuilles (https://docs.microsoft.com/fr-fr/office/vba/api/excel.worksheet.protect)
Public Const DrawingObjects = True
Public Const Contents = True
Public Const Scenarios = True
Public Const UserInterfaceOnly = False
Public Const AllowFormattingCells = True
Public Const AllowFormattingColumns = False
Public Const AllowFormattingRows = False
Public Const AllowInsertingColumns = False
Public Const AllowInsertingRows = False
Public Const AllowInsertingHyperlinks = False
Public Const AllowDeletingColumns = False
Public Const AllowDeletingRows = False
Public Const AllowSorting = True
Public Const AllowFiltering = True
Public Const AllowUsingPivotTables = False
'
Public const MotDePasse = "MotDePasse"
'
'------------------------
'Protection d'une feuille
'------------------------
Sub Protect(WS As Worksheet)
    WS.Protect Password:=MotDePasse, _
               DrawingObjects:=DrawingObjects, _
               Contents:=Contents, _
               Scenarios:=Scenarios, _
               UserInterfaceOnly:=UserInterfaceOnly, _
               AllowFormattingCells:=AllowFormattingCells, _
               AllowFormattingColumns:=AllowFormattingColumns, _
               AllowFormattingRows:=AllowFormattingRows, _
               AllowInsertingColumns:=AllowInsertingColumns, _
               AllowInsertingRows:=AllowInsertingRows, _
               AllowInsertingHyperlinks:=AllowInsertingHyperlinks, _
               AllowDeletingColumns:=AllowDeletingColumns, _
               AllowDeletingRows:=AllowDeletingRows, _
               AllowSorting:=AllowSorting, _
               AllowFiltering:=AllowFiltering, _
               AllowUsingPivotTables:=AllowUsingPivotTables
End Sub
Bonsoir,
Merci pour votre aide.
Comment faire alors pour que je puisse protéger le document afin d'éviter que les utilisateurs puissent entrer des données dans les cellules mais ne puissent pas modifier les titres des colonnes, ou ne puissent pas insérer des colonnes?
Bonsoir
 

Discussions similaires

Réponses
2
Affichages
152

Statistiques des forums

Discussions
312 115
Messages
2 085 441
Membres
102 889
dernier inscrit
monsef JABBOUR